Created
June 16, 2016 14:30
-
-
Save IS-BrianLian/cff04a8d7b17c1d752e86bec25e0a7cf to your computer and use it in GitHub Desktop.
struct_alignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct test { | |
char a; | |
int b; | |
char c; | |
long d; | |
}; | |
int main() { | |
struct test s; | |
printf("char a address is %p\n", &s.a); | |
printf("int b address is %p\n", &s.b); | |
printf("char c address is %p\n", &s.c); | |
printf("long d address is %p\n", &s.d); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment