"Something"
is essentially short for:
static const char some_hidden_array[] = {'S', 'o', 'm', 'e', 't', 'h', 'i', 'n', 'g', '\0'};
some_hidden_array
That is, when you write "Something"
, the compiler generates an array behind the scenes, and gives you a pointer to the start of that array. Since this is already a pointer to a char, you'll have no problem assigning it to a variable of type "pointer to a char" (written as char*
).
10
is not short for anything similar. It's just the number 10 - it's not a pointer to an array containing the number 10, or anything like that.
Note that a char
is a single character, not a string, which is why the string syntax is unusual compared to most other types - a string is several chars, not just one. If you try to use a plain old char
, you'll see the same thing:
char *myChar = 'a'; // error
or for any other type:
float *myFloat = 42.1f; // error
In other words, it's not strange that 10
gives an error - if anything, it's strange that "Something"
doesn't. (At least, it's strange until you know how string literals work)