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

后端 未结 2 2057
甜味超标
甜味超标 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:06

    Move this line:

    return 0;
    

    It will end the loop (function as well as program!).

    0 讨论(0)
  • 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 :)

    0 讨论(0)
提交回复
热议问题