As far as I know the below code should not work. Yet, somehow this is OK on my compiler. Please could someone explain.
int main()
{
char *string;
string = "Goo";
}
As far as I know the below code should not work. Yet, somehow this is OK on my compiler. Please could someone explain.
int main()
{
char *string;
string = "Goo";
}
I'm afraid, your information is wrong.
is perfectly valid. This is basically,
charpointerstring."Goo"intostring.However, instead of being a
charpointer, ifstringwould have been an array, then this would not have been possible as array's cannot be assigned (except definition time though brace enclosed list).