What does for(;;) mean?
The meaning of an infinite loop is to always execute the content in the loop body. . Because there is no specified condition for the loop to end, the program will continue to execute and generate an infinite loop.
Analysis:
for(i=0; i<10; i++) {}
i=0 is to give i an initial value
i<10 is the judgment condition
i is the statement that ends this loop
The first one is empty, we can give i a value before, for example
int i = 0; for(; i<10; i++) {}
The second one is empty. No judgment condition
The third one is empty, that is, there is no statement to drive the end of the loop.
The above expression is completely equivalent to the following
int i = 0; WHILE(1){ i++; }
That is, if all three are omitted The loop body loops forever.
Recommended course: C language tutorial
The above is the detailed content of What does for(;;) mean?. For more information, please follow other related articles on the PHP Chinese website!