Skip to content

Instantly share code, notes, and snippets.

@BrianLian
Created June 16, 2016 14:30
Show Gist options
  • Save BrianLian/cff04a8d7b17c1d752e86bec25e0a7cf to your computer and use it in GitHub Desktop.
Save BrianLian/cff04a8d7b17c1d752e86bec25e0a7cf to your computer and use it in GitHub Desktop.
struct_alignment
#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