Mega Code Archive

 
Categories / C / Code Snippets
 

Get the size of a struct

#include <stdio.h> struct struct_type { int j; char ch; int *p; double d; } s; int main(void) { printf("s_type is %d bytes long", sizeof(struct struct_type)); return 0; }