Search code examples
c++loopsinfinite

Why this for loop does not stop


I have been looking at this code for 20min and I can't understand why this loop is infinite, it should print 30 elements.

Some text, because post is mostly code.


Solution

  • I'm guessing it's because if (i = 1) assigns 1toi. You meant to compareif (i == 1)