On Thu, 19 Oct 2000, Oki DZ wrote:
> Programnya diganti dikit, biar ngeliatnya gampang.
> void callbyreference(char **p) {
[.....]
> }
[.....]
> callbyreference(&coba);
[.....]
> puts(coba);
tapi mestinya nggak perlu mem-pass alamat dari coba ke fungsi
callbyreference(), begini cukup:
#include <stdlib.h>
#include <stdio.h>
void callbyreference(char *p) {
while (*p) *p++ = 'x';
return ;
}
int main(void) {
char *coba = malloc(sizeof(char) * 11);
strcpy(coba, "teststring");
callbyreference(coba);
puts(coba);
free(coba);
}
nah sekarang baru kelihatan gampang :).
atau labih gampang lagi kalo main() di ganti jadi
{
char coba[] = "teststring";
callbyreference(coba);
puts(coba);
}
--
Salam
Yohanes
SMS Mail : [EMAIL PROTECTED]
http://langitbiru.hypermart.net
--------------------------------------------------------------------------------
Utk berhenti langganan, kirim email ke [EMAIL PROTECTED]
Informasi arsip di http://www.linux.or.id/milis.php3
Pengelola dapat dihubungi lewat [EMAIL PROTECTED]
- [programming] call by reference di c for linux Andy
- RE: [programming] call by reference di c for linux commedo
- Re: [programming] call by reference di c for linux mastri
- Re: [programming] call by reference di c for linux Andy
- Re: [programming] call by reference di c for linux Yohanes Nugroho
- Re: [programming] call by reference di c for linux Benny Prijono
- RE: [programming] call by reference di c for linux Sumantri Adiaksana
- Re: [programming] call by reference di c for linux Oki DZ
- Re: [programming] call by reference di c for linux Agus Budy Wuysang
- Re: [programming] call by reference di c for linux Yohanes Nugroho
- Re: [programming] call by reference di c for linux Andy
- Re: [programming] call by reference di c for linux Andy
- Re: [programming] call by reference di c for l... Ronny Haryanto
- Re: [programming] call by reference di c for linux Yohanes Nugroho
- Re: [programming] call by reference di c for linux Yohanes Nugroho
- Re: [programming] call by reference di c for l... Danny Setiawan
- Re: [programming] call by reference di c for linux Benny Prijono
- Re: [programming] call by reference di c for l... Agus Budy Wuysang
- Re: [programming] call by reference di c for linux Agus Budy Wuysang
