Advertisement
mario_mos

teste

Jul 26th, 2023 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 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. typedef struct _noalign {
  8. char c; /* 1 octet */
  9. double d; /* 8 octets */
  10. int i; /* 4 octets */
  11. char c2[3]; /* 3 octets */
  12. }noalign; /* 24 octets car padding */
  13. typedef struct _align{
  14. double d; /* 8 octets */
  15. int i; /* 4 octets */
  16. char c2[3] ;/* 3 octets */
  17. char c; /* 1 octet */
  18. }align; /* 16 octets */
  19.  
  20. int main()
  21. {
  22.  
  23. sizeof(noalign);
  24. sizeof(align);
  25. printf("no align : %d \n align : %d\n",sizeof(noalign),sizeof(align));
  26. return 0;
  27. }
  28. no align : 24
  29. align : 16
  30. 13:31:26: /home/mariomoser/C_learning_journey/build-typedef_suite-Desktop-Debug/typedef_suite exited with code 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement