Loop will run at most once (loop increment never executed)

后端 未结 2 2058
甜味超标
甜味超标 2021-01-20 02:51

I am receiving this error in XCode 6.3.2:

Loop will run at most once (loop increment never executed)

I have tried for (int

2条回答
  •  执念已碎
    2021-01-20 03:26

    I tried two different compilers (Windows/MSVC and Linux/g++) ... and I don't get that warning.

    However - you're doing a "return 0" from your loop.

    Which, of course, defeats the purpose of having a loop :)

    And also happens to terminate your program.

    Move the "return" outside of the loop, and Life should be Good :)

提交回复
热议问题