What is the range of values that can be stored by int
datatype in C?
a) -32768 to 32767
b) -2147483648 to 2147483647
c) 0 to 65535
d) -128 to 127
Answer:
b) -2147483648 to 2147483647
Explanation:
The int
datatype in C typically has a range of -2147483648 to 2147483647 on a 32-bit system, where it occupies 4 bytes (32 bits) of memory. The range is determined by the number of bits used to represent the integer, with one bit reserved for the sign.
Understanding the range of the int
datatype is crucial for ensuring that your program handles numeric values correctly and avoids overflow or underflow errors.