How many bits are in these type?

closed account (ypfz3TCk)
These are two literals:

1
2
"a"
L"a"


I think the first is a string literal that has 8 bits. It's really "a\0". The second is wchar_t string literal and I am guessing has 16 bits. My questions are:

1. What are the minimum size specified by the standard for each of these types?
2. Is there such a type as "wchar_t string literal" or should this be described another way?
Thanks
Characters are guaranteed to be 1 byte each, so, the first string is 2 bytes.
I'm not sure about wchar_t's, but they should be equal or bigger than characters (especially since you can't have a type tinier than 1 byte. On windows they are 2 bytes, and on linux 4 if I remember).

Their type should be something like char[2] const and wchar_t[2] const, but what a developer is interested into is a pointer, so if you should pass them around, you should just remember they are const char* and const wchar_t*.
Topic archived. No new replies allowed.