It was my understanding that the name of an array is a pointer to it's first element. So why does this:
cause error: incompatible types in assignment, meaning I have to do this instead:Code:char string[]="some words"; string=realloc(string, 20);
Can I ask why? And is there a way out? I tried using a seperate pointer (char *ptr; ptr=string) but could not get that to work either...Code:char *string; string=malloc(11); strcpy(string, "some words"); string=realloc(string, 20);