Recently i saw this piece of code. Shouldnt this line be a compile error?char arr[4]="Abc";
What happens here? Is arr a pointer? is the char* copied into an array on stack? is this legal in all version of C++ (and what about C?). I tested and seen this works in VS and code pad which i believe uses gcc
-edit- Just for fun I tried replacing "Abc" with a static const char *. It gave me an invalid initializer error.
int main()
{
int j=97;
char arr[4]="Abc";
printf(arr,j);
getch();
return 0;
}