Advertisement
RicardasSim

sizeof struct

Dec 26th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. //test
  2. {
  3.    
  4.     struct st1{
  5.         int x;
  6.         int y;
  7.         int z;
  8.     };
  9.    
  10.     struct st2 {
  11.         char* name;
  12.         struct st1 stt1;
  13.     };
  14.    
  15.     printf("sizeof int: %zu\n", sizeof(int));
  16.     printf("sizeof char*: %zu\n", sizeof(char*));
  17.     printf("%zu\n", sizeof (struct st1));
  18.     printf("%zu\n", sizeof (struct st2));
  19.    
  20. }
  21.  
  22. /*
  23. sizeof int: 4
  24. sizeof char*: 8
  25. 12
  26. 24
  27. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement