Originally Posted by
krkr
So we can't initialize a double pointers?
You can, but not like this. For example, you can do:
Code:
const char *ch2[] = { "abc", "def" }; // ch2 has to be stored somewhere, of course
const char **ch = ch2;
or if you'd like to go the dynamic allocation route:
Code:
const char **ch = malloc(sizeof(char*)*2);
ch[0] = "abc";
ch[1] = "def";
...
free(ch);
or you could even scratch this double-pointer idea and try something else, like a multi-string:
Code:
const char *ch = "abc\0def\0";
// This needs extra code for some things though