I am trying to understand pointer to pointers and I can not understand why in first case I need (&) ampersand ( I receive a message [Error] cannot convert 'char*' to 'char**' in assignment ) and in the second case I don't need ampersand
first case :
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main ()
{
char *p ={"jack is a good boy"};
char**p1;
p1=p; //why I need & in this case
return0;
}
second case :
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main ()
{
char *p[5] ={"jack","is", "a","good","boy"};
int i=0;
char**p1;
p1=p;
//p1=&p[0];
for(p1=p; *p1; p1++)
{
printf("\n the words are %s",*p1);
}
return 0;
}