When I try the second option in the following code to initialize names, I get a segmentation fault. I guess there is something conceptually incorrect with the second option. Any ideas?
char *names[] = {
"Alan", "Frank",
"Mary", "John", "Lisa"
};
char **names = {
"Alan", "Frank",
"Mary", "John", "Lisa"
};
Yes. In first case, you have an array of pointers. Each pointer points to a separate item(Alan, Frank…)
The second declaration
implies that names is a pointer to a pointer[You cannot initialize a set of strings like this]. As in