kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

ctl_nested.c (498B)


      1 /* Doubly-nested counted loops with no break/continue: pure back-edges. The
      2  * inner loop contributes a multiply-accumulate; volatile bounds keep both loop
      3  * structures real so the inner back-edge, outer back-edge, and both exit
      4  * branches round-trip. 6 outer * 7 inner = 42 increments. Exit code 42. */
      5 int test_main(void) {
      6   volatile int rows = 6, cols = 7;
      7   int count = 0;
      8   for (int i = 0; i < rows; i++) {
      9     for (int j = 0; j < cols; j++) {
     10       count += 1;
     11     }
     12   }
     13   return count;
     14 }