Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- #include <time.h>
- #include <string.h>
- union{
- int a;
- char c;
- double d;
- //exo 1
- // struct {
- // unsigned b : 1;
- // unsigned c : 8;
- //};
- }x;
- // union avec int car double dans une union
- int main()
- {
- x.a='F'; //afficher en caractere %c , %d en nombre
- printf(" Ix.a vaut : %d\n",x.a);
- x.c ='Y';
- printf(" IIx.c vaut : %c\n IIx.a vaut : %d\n",x.c,x.a);
- x.d = 'Y';
- printf(" IIIx.c vaut : %c\n IIIx.a vaut : %d\n IIIx.d vaut : %f\n",x.c,x.a,x.d);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement