MIPI_BaseC_WebinarFRTK/23_Seminar10/02_union_pi_p8.c

19 lines
336 B
C
Raw Permalink Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
#include <inttypes.h>
union intbytes {
uint32_t number;
float real;
uint8_t bytes[4];
} d;
int main()
{
d.real = 3.14;
printf ("Real %f\n",d.real);
printf ("Number %x",d.number);
printf(" in memory is: %x %x %x %x\n", d.bytes[0],
d.bytes[1], d.bytes[2], d.bytes[3]);
return 0;
}