We do not cast a string when initialise a pointer:
char *string = "Hello World!";
However, if I try to define an array explicitly (whatever it is of), the compiler gives me a warning of type incompatibility:
char *string = {'H', 'e', 'l', 'l', 'o', '\0'};
Casting to char[] works, but I wonder why do we have to cast? Doesn't a compiler see that the initialising value {'H', 'e', 'l', 'l', 'o', '\0'} is already an array? If we initialise an array like string[] the same way, we do not have to cast though. I assume here the compiler sees what the initialising value is, why doesn't it see it when initialising a pointer?