Step 1: Start
Step 2: Declare a union with int, float, and char members
Step 3: Assign a character value to the union
Step 4: Assign an integer value to the union (overwrites previous)
Step 5: Assign a float value to the union (overwrites previous)
Step 6: Print all members of the union
Step 7: End
#include <stdio.h> union Number { int intValue; float floatValue; char charValue; }; int main() { union Number num; num.charValue = 'A'; num.intValue = 10; num.floatValue = 3.14; printf("Char value: %c\n", num.charValue); printf("Integer value: %d\n", num.intValue); printf("Float value: %.2f\n", num.floatValue); return 0; }
Char value: ��� Integer value: 1078523331 Float value: 3.14