How does C++ handle char literals that are assigned to unsigned char variables?
- Converts to signed char
- Preserves exact value
- Converts to int
- Triggers an error
When a char literal is assigned to an unsigned char variable, C++ preserves its exact value. If the char literal's value is negative, when assigned to an unsigned char, it wraps around using standard two's complement arithmetic.
Loading...
Related Quiz
- C++ was initially called _______ during its early development phase.
- In a function that needs to return multiple values, which method of parameter passing might be employed to facilitate this without using data structures like tuples or pairs?
- Consider enum class in C++11 and above. Which of the following is a true statement about its functionality?
- What does the "++" symbolize in the C++ programming language?
- To define an abstract class in C++, at least one member function must be declared as _______.