Say I want to read in a list of pages name of max 19 character, e.g. 4 (Number of page) Name1 Name2 Name3 Name4
I am trying to use a global 2D array to store the page number and page name, I got an error saying assignment from incompatiable pointer type...
Thanks
static int nPages;
static char** pageName;
int main(void){
scanf(" %d", &nPages);
pageName = (char *)malloc(nPages*sizeof(char));
for(int i=0; i < nPages ;i++){
pageName[i] = (char *)malloc(20*sizeof(char));
scanf(" %s", pageName[i]);
}
//Free Memory Here of coz.
return 0;
}