Discussion
The type to use for a variable that must hold values from 0 to 200 in the least space is
Answer: C
Correct answer: uint8_t
An unsigned 8-bit type holds 0 to 255, which covers the range in one byte. uint16_t and unsigned int would work but waste space, and int8_t reaches only 127 and would overflow. The fixed-width types from stdint.h are used precisely so the size is stated rather than assumed.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development