I have the following code:
char *array1[3] =
{
"hello",
"world",
"there."
};
struct locator_t
{
char **t;
int len;
} locator[2] =
{
{
array1,
10
}
};
It compiles OK with "gcc -Wall -ansi -pedantic". But with another toolchain (Rowley), it complains about
warning: initialization from incompatible pointer type
on the line where char **t is. Is this indeed illegal code or is it OK?
Thanks for all the answer. I now know where my problem was. However, it raises a new question:
Seems perfectly legal to me; char *[3]
decays to char **
, so the assignment should be valid.
Neither GCC 4.4.5 nor CLang 1.1 complains.