Home >Backend Development >C#.Net Tutorial >What does for(;;) mean?

What does for(;;) mean?

angryTom
angryTomOriginal
2019-10-23 14:43:4625326browse

What does for(;;) mean?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn