A

Akash Lawaniya • 9.58K Points
Tutor III

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

  • (A) 8
  • (B) 4
  • (C) 2
  • (D) 1

Explanation by: Mr. Dubey

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics