C中的函数定义、函数调用和声明语句是什么?

Are function definitions, function calls and declarations statements in C?

说到C语言的语句,我们通常会想到表达式语句、循环语句、条件分支语句、无条件跳转语句。

C 编程语言中是否考虑了以下语句:

如果其中一些不是语句,它们分别是什么?

谢谢。

在 C(与 C++ 相反)中,声明不是语句。

来自 C 标准(6.8 语句和块)

Syntax

1 statement:
    labeled-statement
    compound-statement
    expression-statement
    selection-statement
    iteration-statement
    jump-statement

C++ 标准还包括

declaration-statement

函数的调用(即使函数的 return 类型为 void)可以是表达式语句或表达式的一部分。

来自 C 标准(6.8.3 表达式和空语句)

2 The expression in an expression statement is evaluated as a void expression for its side effects

和(6.3.2.2 无效)

1 The (nonexistent) value of a void expression (an expression that has type void) shall not be used in any way, and implicit or explicit conversions (except to void) shall not be applied to such an expression. If an expression of any other type is evaluated as a void expression, its value or designator is discarded. (A void expression is evaluated for its side effects.)

一个函数定义同时也是一个函数声明。

来自 C 标准(6.7 声明)

5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition of an identifier is a declaration for that identifier that:

— for a function, includes the function body;

考虑这个程序

#include <stdio.h>

int main(void) 
{
    goto L1;

    L1:; char *s = "Hello";

    puts( s );

    return 0;
}

它的输出是

Hello

但是如果去掉标签后的分号L1:(即去掉空语句)编译器会报错,因为声明不是语句,标签不能与a一起使用宣言.