Singleton said:
what is wrong with my main fn?
void f(char** p)
{
printf("%s", p[0]);
}
void main()
{
char a[50][50];
strcpy(a[0], "hello");
f(a);
}
char[50][50] cannot be converted to char**.
You probably thought that because char[50] does convert to char* that
char[50][50] could convert to char** but you were wrong.
The correct rule is that T[N] can convert to T*, so in the case of
char[50][50] T=char[50], therefore char[50][50] converts to char(*)[50]
(i.e. a pointer to an array of 50 chars) not to char** (a pointer to a
pointer to a char).
So rewrite f like this
void f(char (*p)[50])
{
printf("%s", p[0]);
}
and your program will work.
Get a C or C++ book and read the section on declarations. As you've seen
sometimes your intuition will let you down.
john