Home  >  Article  >  Backend Development  >  What does continue mean in C language?

What does continue mean in C language?

Guanhui
GuanhuiOriginal
2020-06-19 11:13:5010967browse

What does continue mean in C language?

#What does continue mean in C language?

continue in C language means to end this loop and proceed to the next loop. Its function is to jump out of the unexecuted statements below in the loop body. For while loops, continue to solve the loop conditions, and for for The loop program then evaluates the expression in the for statement header.

Recommended tutorial: "C#"

Code example

#include<stdio.h>
int main()
{
    int n;
    for(n=1;n<=10;n++)
    {
        if(n%3==0)
            continue;
        printf("%d\t",n);
    }
}
//其作用是:结束本次循环,即跳过循环体下面尚未执行的语句,接着进行下一次是否执行循环的判断.

Output results

1 2 4 5 7 8 10

continue is used in the loop structure to skip the remaining code in this loop and start executing the next loop when the condition evaluates to true.

Recommended article: "C#"

The above is the detailed content of What does continue mean in C language?. 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