If i create a
char a[100][100];
and send to a function void func(char** a);
It says that a char ()[100] cannot be converted to char *.
I imagined that a char [100][100] is like a pointer to pointer.
Was i wrong?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you were wrong indeed. a
char[100][100]is an array of (array of 100char), and when passing it to a function, it is converted to a pointer to (array of 100char), achar (*)[100]. The conversion of arrays to pointers when passed as function arguments only affects the outermost level of arrays.You could either declare the function as taking a parameter of that type,
if you will always pass arrays with 100 columns, or you would have to pass a different argument if you want to keep the function’s type.