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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -