Home >Backend Development >C#.Net Tutorial >What does each statement in C language end with?
#What does each statement in C language end with?
Every statement in the C language source program ends with ";" in the English input state.
Different programming languages have different end marks. Java and C also use ";" as the end mark of a line of statements. There are also programming languages that do not need to use ";" as the end of a line of statements, such as Python. Python uses spaces to determine the relationship between statements. After a line of statements ends, just change the line and continue writing.
C language does not require a semicolon when inputting header files or writing macros, and ends directly with a newline.
Extended information:
There is no semicolon after the while (expression) in C language. If a semicolon is accidentally added, the system will not cause a compilation error. , but the program will continue to perform no-operations, forming an empty loop body, unable to execute "while (expression);" and subsequent programs, and will not achieve the expected effect. For example, adding a semicolon to a while loop in a cumulative summation program will cause an error.
In the do...while loop statement, there is a semicolon after while. Like ordinary statements, this semicolon is used to end the statement. If this semicolon is omitted, the program will not compile and an error will occur.
Recommended tutorial: "c Language Tutorial"
The above is the detailed content of What does each statement in C language end with?. For more information, please follow other related articles on the PHP Chinese website!