0010 0000 2 0
538976288
// Unions #include <stdio.h> union xyz { int x; char y; struct x1{ int x2; float y2; }xx1; }; int main() { union xyz xy; xy.x=321; printf("x = %d\t y= %d",xy.x,xy.y); xy.y='Z'; printf("x = %d\t y= %d",xy.x,xy.y); }
#include <stdio.h> union xyz { int x; char y; struct x1{ int x2; float y2; }xx1; }; int main() { union xyz xy; xy.x=321; printf("x = %X\t y= %X\n",xy.x,xy.y); xy.y='Z'; printf("x = %X\t y= %X\n",xy.x,xy.y); return 0; }
D:\rhs\c>rat x = 141 y= 41 x = 15A y= 5A
xy.x = 321
0x00000141
0001 0100 0001
0001 0100 0001 1 4 1
0000 0000 0000 0000 0000 0001 0100 0001