The following code is perfect valid,
int *ia = (int[]){1,3,5,7};
but when I compile the next line of code,
char *p = (char[]) "abc";
gcc says
test.c:87: error: cast specifies array type
It seems they are casted in the same way. Why did the second one get an err msg?
As you guys said, "abc" is a pointer, which cannot be converted to be a pointer. So my another question: why does
char[] s = "abc";
is valid. How does the above line of code work when compiling?