The statement that ends this loop in C language is "continue". The control statement continue can only be used in the loop body. Its function is to end this loop and jump to the position where the loop is judged, that is, to restart the next loop.
The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.
In C language, the control statement "continue" is used in the loop body to end this loop and restart the next loop.
In C language, the statements that control the execution sequence mainly include break statement, continue statement, goto statement, exit function and abort function.
The break statement is used in a loop statement or switch() statement. When the statement is executed, the loop statement or switch statement is directly ended and the control is transferred to the loop immediately following it. statement or the statement after the switch statement.
The continue statement can only be used in the loop body. Its function is to end this loop and jump to the position where the loop is judged, that is, to restart the next loop.
The goto statement can be transferred from the conditional statement or loop statement to the label outside the statement for execution.
The exit() and abort() functions are used to terminate the execution of the program and return control to the operating system.
Tutorial recommendation: "c language tutorial video"
continue statement
continue statement The function is to skip the remaining statements in the loop body and force entry into the next loop. The continue statement is only used in while and for loops, and is often used together with the if conditional statement to determine whether the condition is true.
Example:
#include <stdio.h> int main(){ char c = 0; while(c!='\n'){ //回车键结束循环 c=getchar(); if(c=='4' || c=='5'){ //按下的是数字键4或5 continue; //跳过当次循环,进入下次循环 } putchar(c); } return 0; }
Run result:
0123456789↙ 01236789
For more computer programming related knowledge, please visit:Programming Teaching! !
The above is the detailed content of What is the statement that ends this loop in C language?. For more information, please follow other related articles on the PHP Chinese website!