boot2

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

088-chained-assign.c (393B)


      1 /* Chained assignment is right-associative. C99 6.5.16. */
      2 
      3 int main(int argc, char **argv) {
      4     int a, b, c;
      5     a = b = c = 7;
      6     if (a != 7) return 1;
      7     if (b != 7) return 2;
      8     if (c != 7) return 3;
      9     /* Result of assignment is the lhs after assignment. */
     10     int x = (a = 3) + (b = 4);
     11     if (x != 7) return 4;
     12     if (a != 3) return 5;
     13     if (b != 4) return 6;
     14     return 0;
     15 }