A

Admin • 833K Points
Coach

Q. What is the size of float in a 32-bit compiler?

  • (A) 8
  • (B) 4
  • (C) 2
  • (D) 1
  • Correct Answer - Option(B)
  • Views: 22
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

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
", sizeof(float));
return 0;
}

Output:

Size of float: 4 bytes

Final Answer:

(B) 4

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.