boot2

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

104-bool-type.c (438B)


      1 /* _Bool type: 1 byte, values 0 or 1. CC.md §Types lists _Bool. */
      2 
      3 int main(int argc, char **argv) {
      4     _Bool t = 1;
      5     _Bool f = 0;
      6     if (sizeof(_Bool) != 1) return 1;
      7     if (t != 1) return 2;
      8     if (f != 0) return 3;
      9 
     10     /* Assigning a non-zero scalar should produce 1, not the raw value. */
     11     _Bool b = 42;
     12     if (b != 1) return 4;
     13 
     14     /* Negation. */
     15     if (!t != 0) return 5;
     16     if (!f != 1) return 6;
     17     return 0;
     18 }