C 语句概述Overview of C Statements

C 语句由标记、表达式和其他语句组成。C statements consist of tokens, expressions, and other statements. 构成另一个语句的组成部分的语句称为封闭语句的“体”。A statement that forms a component of another statement is called the "body" of the enclosing statement. 本节中将讨论以下语法给定的每个语句类型。Each statement type given by the following syntax is discussed in this section.

语法Syntax

statementstatement:
labeled-statementlabeled-statement

compound-statementcompound-statement

expression-statementexpression-statement

selection-statementselection-statement

iteration-statementiteration-statement

jump-statementjump-statement

try-except-statementtry-except-statement

/* Microsoft 专用 */try-finally-statement /* Microsoft 专用 *//* Microsoft Specific */try-finally-statement /* Microsoft Specific */

通常,语句体为“复合语句”。Frequently the statement body is a "compound statement." 复合语句由可包含关键字的其他语句组成。A compound statement consists of other statements that can include keywords. 复合语句由大括号 ({ }) 分隔。The compound statement is delimited by braces ({ }). 所有其他 C 语句以分号 (;) 结尾。All other C statements end with a semicolon (;). 分号是语句结束符。The semicolon is a statement terminator.

表达式语句包含可包含表达式和赋值中介绍的算术或逻辑运算符的 C 表达式。The expression statement contains a C expression that can contain the arithmetic or logical operators introduced in Expressions and Assignments. null 语句是空语句。The null statement is an empty statement.

所有 C 语句都可以以由名称和冒号组成的标识标签开头。Any C statement can begin with an identifying label consisting of a name and a colon. 由于只有 goto 语句可识别语句标签,因此语句标签将与 goto 一起讨论。Since only the goto statement recognizes statement labels, statement labels are discussed with goto. 有关详细信息,请参阅 goto 和标记语句See The goto and Labeled Statements for more information.

另请参阅See Also

语句Statements