boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

025-sizeof.c (391B)


      1 /* tests/cc-e2e/25-sizeof.c — sizeof on int, char, struct, array.
      2  * Split from 01-kitchen-sink. */
      3 
      4 struct Point { int x; int y; };
      5 int g_arr[3] = { 10, 20, 30 };
      6 
      7 int test_sizeof(void) {
      8     return sizeof(int) + sizeof(char) + sizeof(struct Point) + sizeof(g_arr);
      9     /* 4 + 1 + 8 + 12 = 25 */
     10 }
     11 
     12 int main(int argc, char **argv) {
     13     if (test_sizeof() != 25) return 1;
     14     return 0;
     15 }