Home  >  Article  >  Backend Development  >  What does a C language statement end with?

What does a C language statement end with?

coldplay.xixi
coldplay.xixiOriginal
2020-11-20 11:22:388054browse

Each statement in the C language ends with [;] in the English input state. Different programming languages ​​have different end marks. Java and C also use [;] as a line statement. As an end mark, there are also programming languages ​​that do not need to use [;] as the end of a line of statements.

What does a C language statement end with?

[Related learning recommendations: C language tutorial video]

c language source program Each statement in the English input state ends with ";".

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. For example, 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.

What does a C language statement end with?

Extended information:

There is no semicolon after the while (expression) in C language. If you accidentally add a semicolon No., the system will not have compilation errors, but the program will continue to perform no operations, forming an empty loop body, unable to execute the program following "while (expression);", 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.

The above is the detailed content of What does a C language statement end with?. 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