boot2

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

099-init-zero-tail.c (474B)


      1 /* Partial initializer: missing trailing initializers are zero. C99 6.7.8 */
      2 
      3 int main(int argc, char **argv) {
      4     int a[5] = { 1, 2 };           /* a[2..4] = 0 */
      5     if (a[0] != 1) return 1;
      6     if (a[1] != 2) return 2;
      7     if (a[2] != 0) return 3;
      8     if (a[3] != 0) return 4;
      9     if (a[4] != 0) return 5;
     10 
     11     struct S { int x; int y; int z; };
     12     struct S s = { 7 };
     13     if (s.x != 7) return 6;
     14     if (s.y != 0) return 7;
     15     if (s.z != 0) return 8;
     16     return 0;
     17 }