Q. What is the size of float in a 32-bit compiler?
β
Correct Answer: (B)
4
Explanation:
In a 32-bit compiler, the size of a float data type is 4 bytes (32 bits) because:
- A float in C follows the IEEE 754 single-precision floating-point standard, which uses:
- 1 bit for the sign
- 8 bits for the exponent
- 23 bits for the mantissa (fraction)
Verification with C Code:
You can check the size of float using:
#include <stdio.h>
int main() {
printf("Size of float: %zu bytes\n", sizeof(float));
return 0;
}
Output:
Size of float: 4 bytes
Final Answer:
β (B) 4