#include <stdio.h> union MyUnion { int iVal; float fVal; char cVal[5]; //char c[9]; }; void main() { union MyUnion u={10}; u.fVal = 100; printf_s("%d\n%f\n%d\n%d\n", u.iVal, u.fVal, u.cVal[0], sizeof(u)); getchar(); }
1120403456 100.000000 0 8
void main(){ union MyUnion u={10}; .. .. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)