/*1*/ const char *const letter = 'A';
/*2*/ const char *const letter = "Stack Overflow";
Why is 1 invalid but 2 valid?
letter is a pointer that needs to be assigned an address. Are quoted strings addresses? I'm assuming this is why #2 is valid and that single quoted strings are not considered addresses?
Also, what is the difference between these two casting types?:
static_cast<>
and ()
.
And lastly, if var is a char variable, why does cout << &var << come out garbled? Why must I cast it to void*?
Thanks you for your patience with beginner questions.