Q:
Hi Peter..
could you please tell me in the following example..
main()
{
char *desk[1];
void cal(char **);
desk[0]="Main";
cal(desk);
printf("%s\n", desk);
}
void cal(char **a)
{
*a="Sub";
printf("%s\n", *a);
}
i get the value as
a: Sub
b: Main
I dont unserstand the reason why the value has not changed in main
although i have made *a=Sub..
could you clarify this for me... with what exactly happens to get this
answer i tried my best to findout...
thanx and regards
*NAME-DELETED*
A:
It actually does. The issue is that you have
printf("%s\n", desk);
instead of
printf("%s\n", desk[0]);
Never mind such a mistake. I have several years of experience with C (13
years actually) and even though I created a Visual C project, a new file,
copied the text into it and started to debug to realize what the mistake
was.
Regards,
Peter
[ back to toc ]