Advertisement
mario_mos

union3

Jul 26th, 2023
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <string.h>
  6.  
  7.  
  8. union{
  9. int a;
  10. char c;
  11. double d;
  12.  
  13. //struct{
  14. // unsigned b : 1;
  15. // unsigned c : 1;
  16. //};
  17. }x;
  18.  
  19.  
  20.  
  21.  
  22. // union avec int car double dans une union
  23.  
  24. int main()
  25. {
  26. x.a=9;
  27. x.a="A"; //afficher en caractere %c , %d en nombre
  28. printf("%d\n",x.a);
  29.  
  30. return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement