Home  >  Article  >  Backend Development  >  In C language, what is the ending character of a simple statement?

In C language, what is the ending character of a simple statement?

青灯夜游
青灯夜游Original
2020-07-27 11:36:576397browse

In C language, the terminator of a simple statement is: semicolon (;). Statements in C language are divided into simple statements and compound statements. Simple statements are marked with a semicolon ";" as the end mark, and "}" is used as the end mark of the statement.

In C language, what is the ending character of a simple statement?

Statements in C language are divided into simple statements and compound statements.

Simple statements end with a semicolon (;). Among the simple statements, there are assignment statements, declaration statements, structured statements, function call statements and empty statements. Compound statements refer to using curly braces {} to wrap simple statements or even other compounds, so } is used as the end mark of a statement.

Examples are as follows:

printf("HelloWorld")   // 不加分号,在编译的时候会报错
printf("HelloWorld");  // 编译的时候不会报错,输出HelloWorld

It should be noted that macro definitions do not require semicolons, such as:

#define PI 3.14   // 不用加分号,加了分号会报错

Recommended: "c Language Tutorial"

The above is the detailed content of In C language, what is the ending character of a simple statement?. 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