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>
- typedef struct _noalign {
- char c; /* 1 octet */
- double d; /* 8 octets */
- int i; /* 4 octets */
- char c2[3]; /* 3 octets */
- }noalign; /* 24 octets car padding */
- typedef struct _align{
- double d; /* 8 octets */
- int i; /* 4 octets */
- char c2[3] ;/* 3 octets */
- char c; /* 1 octet */
- }align; /* 16 octets */
- int main()
- {
- sizeof(noalign);
- sizeof(align);
- printf("no align : %d \n align : %d\n",sizeof(noalign),sizeof(align));
- return 0;
- }
- no align : 24
- align : 16
- 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