RicardasSim

sizeof struct

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