In a graphics rendering engine, you need to store RGB color values. Which data type would be most appropriate for each color channel to balance memory usage and color depth?
- float
- int
- unsigned char
- long
Each RGB color channel requires values from 0 to 255. An unsigned char can store values in this range using just 8 bits, making it efficient in memory usage. Using larger data types like int or float would be wasteful in terms of memory without providing additional benefits for this use case.
Loading...
Related Quiz
- The _______ statement is used to prematurely exit a switch-case block.
- The ASCII value of 'A' in decimal is _______.
- The loop do { /* code */ } while(_______); will always execute the code block at least once.
- What is the output of the logical NOT (!) operator when applied to a non-zero operand?
- What does the term “Diamond Problem” refer to in the context of C++ inheritance?