how to retern a double pointer from a function.y the following code is not working..
char **func(void);
main()
{
char **ch;
ch=func();
prinyf("%s%s",ch[0],ch[1]);
}
char **func()
{
char *p[2]={"a","b"};
char **k;
k=p;
return(k);
}
The local variables will be destroyed after the function where they are declared is finished. Thus, you cannot use the result. One simple method is to use a global variable instead of the local variable.