For example, what is the type of the string literal "Hello", const char[6]
or const char*
?
The type of the string literal "Hello"
is "array of 6 const
char
".
Ordinary string literals and UTF-8 string literals are also referred to as narrow string literals. A narrow string literal has type “array of n
const char
”, where n is the size of the string [...]
It can, however, be converted to a const char*
by array-to-pointer conversion. Array-to-pointer conversion results in a pointer to the first element of the array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With