Pointers to arrays problem in C -
i have function takes pointer of array (in order modify within function)
int func_test(char *arr[]){ return 0; } int main(){ char var[3]; func_test(&var); return 0; }
when try compile :
passing argument 1 of ‘func_test’ incompatible pointer type
why problem, , how pass pointer array in case?
char * arr[]
not pointer array; array of pointers. declarations in c read first identifier towards right, identifier towards left. so:
char * arr[]; // ^ arr is... // ^ array of... // ^ pointers to... // ^ char
Comments
Post a Comment