void test(char **arr)
{
// do something
}
int main()
{
char arr[10][25];
test(arr);
}
When I try to compile this using gcc v8.2.1, it gives me the following errors:
prog.c:8:8: warning: passing argument 1 of ‘test’ from
incompatible pointer type [-Wincompatible-pointer-types]
test(arr);
^~~
prog.c:1:19: note: expected ‘char **’ but argument is of type ‘char (*)[25]’
void test(char **arr)
~~~~~~~^~~
This is for homework, so I am not allowed to change the test function to take an array (rather than a pointer to a pointer) and I need to ensure the array declared in main have those dimensions (no more and no less).
How should I go about doing this?