code snippet:
int *c[2] = {{1,2,3}, {4,5,6}};
gives warning:
warning: incompatible integer to pointer conversion initializing 'int *' with an expression of type 'int'
[-Wint-conversion]
int *c[2] = {{1,2,3}, {4,5,6}};
^
warning: excess elements in scalar initializer
int *c[2] = {{1,2,3}, {4,5,6}};
^
I suppose array {1,2,3} would decay to pointer so the assignment be legit?
Further more, according to the warning, why does the compiler think i'm trying to assign int to int *? instead of int array type to int *? Thanks in advance!
int c[2][3]with the given data.cis a 2-element array of pointers, you cangcc -Sto check the assembly implementation compared withint cc[2][3].int c[2][3]