Home > Back-end >  How to just calculate infinite loop?
How to just calculate infinite loop?

Time:10-02

This topic is not infinite loop?

CodePudding user response:

Infinite loop is program has been periodically run a period of instruction, never stop, statements given in the figure is not infinite loop, because the judgment condition is type int, k k increases will not always, when k more than its biggest border, will start growing from another negative boundaries, then when growth to 0, end of cycle

CodePudding user response:

0 x00000001
0 x00000002
.
.
0 XFFFFFFFF
0 x00000000

GAME OVER!!!!!

CodePudding user response:

Note there is a range of k: - 2147483648 ~ 2147483647, thus k++ will become zero.

CodePudding user response:

For (k=1; K -; K++) printf (" % d ", k);
This should be able to die

CodePudding user response:

K is type int
The cycle will eventually lead to overflow k
A signed type overflow is undefined behavior
Results the meaningless
Specific possible infinite loop here may not
People draw that low levels of employing
Don't tube
If k is unsigned types this title is no problem

CodePudding user response:

Also have a range of the size of the plastic data, is beyond the range is over
  • Related