Skip to content

Instantly share code, notes, and snippets.

@good5dog5
Created March 17, 2015 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save good5dog5/6638ebf4be62bf094912 to your computer and use it in GitHub Desktop.
Save good5dog5/6638ebf4be62bf094912 to your computer and use it in GitHub Desktop.
#include<stdio.h>
struct ABC {
int index;
char name[6];
int score;
} __attribute__((packed));;
struct DEF {
int att;
char name[3];
} __attribute__((packed));;
int main(int argc, char ** argv)
{
printf("sizeof(ABC) = %d\n", sizeof(struct ABC));
printf("sizeof(DEF) = %d\n", sizeof(struct DEF));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment