as many guys said, the char [12][12] and char ** are different types,
and of course can't covert into each other.
but in C/C++, the char [12] and char *p are the same expect the latter
lost the length information.
IOWs, they are not the same. There is in C and C++ what
can be considered an anomaly. In short, we can do this:
char c = 'x';
char a[] = "blah";
char *p;
and then both of these will work:
p = &c;
p = a;
Neither of these is probably surprising, but, it's easy to think
or say in the second case "p points to the array a". The "problem"
is that of course it is only pointing to the first character of a.
After all, p is declared as pointer to A char. A as in one.
The type of a is char[5]. In some (most) circumstances, it get
CONVERTED to a char *. This means information is indeed lost.
This is a problem, because we have the notion of incementing a pointer.
However, this is not a good idea:
p = &c;
p++; // Huh?
Nor even this:
char one[1] = { 'c' };
p = one;
p++; // Yikes!
IOWs, things such as bounds checking are not a requirement
upon an implementation or the code it generates.o
This happens at even level of indirection, but usually because
we normally stay in the level we're in the collapsing of the most
immediate dimension is seen as reasonable while those at others are not.
So, this would not seem reasonable:
char a2[4][5];
p = a2;
EVEN THOUGH, the programmer may have just wanted to travese
the 20 char for some reason. You can of course cast the assignment
to a char *, but then you're on your own, even more so than normal.
Not only do you loose the most immediate dimension but you loose both.
Normally that's too much lost and so normally becomes an error to
be allowed to happen implicitly. After all, you made it a 2d array
instead of a 1d array for some reason. So with a2 normally you'd
want to be dealing with each char[5] (a2[0], a2[1], a2[2], a2[3], a2[4]).
or each char (a2[x][y]) and not changing it into some other shape.