Empty statements are allowed in c source programs. The empty statement is a special statement in C language or C; if a statement has only one semicolon ";", it is called an empty statement. In programs, empty statements are mainly used to empty loop bodies.
# Empty statements are allowed in c source programs.
In C language or C, there is a special statement called an empty statement.
In C language or C, if a statement has only one semicolon ";", it is called an empty statement. To put it simply, there is no execution code, only a ";" semicolon to mark the end of the statement.
The empty statement is a statement that executes nothing. In the program, the empty statement is mainly used to empty the loop body, such as:
while(getchar()!='\n');
The function of this statement is to require the user to re-enter as long as the character entered from the keyboard is not a carriage return. That is, the user is required to press Enter before continuing with the subsequent program. In this part of the code, receiving the user's keystrokes and judging the contents of the keystrokes are all concentrated in the while judgment. Therefore, there is no need to perform any functions in the loop body. Just inside the loop body, enter an empty statement as the loop body.
Recommended: "c Language Tutorial"
The above is the detailed content of Are empty statements not allowed in C source programs?. For more information, please follow other related articles on the PHP Chinese website!