fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct Test
  5. {
  6. int a;
  7. int b;
  8. char c;
  9. } Test;
  10.  
  11. int main(void)
  12. {
  13. Test *obj = (Test*)malloc(sizeof(Test));
  14.  
  15. printf("Size results:\r\n\r\nstruct: %i\r\nint #1: %i\r\nint #2: %i\r\nchar #1: %i\r\n",
  16. sizeof(Test), sizeof(obj->a), sizeof(obj->b), sizeof(obj->c));
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 1808KB
stdin
Standard input is empty
stdout
Size results:

struct: 12
int #1: 4
int #2: 4
char #1: 1