I'm learning to get used to the pointers in C and I have a question about them that I coudln't understand. Anyways, why this code gives segmentation fault?
void print_arr(const char *p_array[]){
int index;
for(index = 0; p_array[index] != 0; index++)
printf("%s\n", *p_array[index]);
}
while the one without a '*' in printf work perfectly
void print_arr(const char *p_array[]){
int index;
for(index = 0; p_array[index] != 0; index++)
printf("%s\n", p_array[index]);
}
The whole code is taken from here
Click Here. Thanks!