char
char* c[30];
c = (char*) malloc(30*sizeof(char) );
How does this give an incompatible declaration in built in function warning and and incompatible types in assignment error in the line where i have declared malloc . According to the syntax of malloc , i shouldnt have any error
You have declared
cas an array. You can’t change the value of an array, and an array is not a pointer.chas the type(char*)[30](i.e. an array of 30 char pointers) , notchar*as your cast suggests.If you’re trying to create a dynamically allocated char “array” for 30 chars, use
If you really want an array of 30 char pointers, and e.g. allocate space for 30 chars in each of its elements, use