What are the uses of a pointer to a pointer in C
and when to use?
Because I'm used to see something like this most often
const char *foo(char **foo);
but when I do something like this:
#include <stdio.h>
char *foo(char **foo)
{
printf("b : %s \n ", foo);
*foo = "World";
printf(" c %s \n ", foo);
}
main()
{
static char *test = "Hello";
foo(&test);
printf("a : %s \n ", test);
}
it compiles good but both b and c get corrupted and a never changes. please help me , what am I doing wrong?