Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- union X
- {
- int i;
- int j;
- double k;
- }; // ; compulsory
- struct Y
- {
- int i;
- int j;
- double k;
- };
- int main()
- {
- printf("sizeof X is %lu\n",sizeof(union X));
- union X x1;
- x1.i = 23;
- x1.j = 23;
- x1.i = 49;
- printf("%d %d\n",x1.i, x1.j);
- printf("sizeof Y is %lu\n",sizeof(struct Y));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement