74. Unions-II

Question.3

A developer stores a sensor reading in a union to send both int and float representations:

union {
   int32_t i;
   float f;
} reading;

reading.i = 1000;     // Store integer reading
reading.f = 25.5f;    // Store float reading

printf("Int: %d\n", reading.i);
printf("Float: %.1f\n", reading.f);

What does reading.i print?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!