函数声明和定义Function Declarations and Definitions

函数原型确定了函数的名称、返回类型以及形参的类型和数量。Function prototypes establish the name of the function, its return type, and the type and number of its formal parameters. 函数定义包括函数体。A function definition includes the function body.

备注Remarks

函数声明和变量声明均可出现在函数定义的内部或外部。Both function and variable declarations can appear inside or outside a function definition. 函数定义中的所有声明应在“内部”或“局部”级别显示。Any declaration within a function definition is said to appear at the "internal" or "local" level. 所有函数定义之外的声明应在“外部”、“全局”或“文件范围”级别显示。A declaration outside all function definitions is said to appear at the "external," "global," or "file scope" level. 变量定义(如声明)可在内部级别(在函数定义中)或在外部级别(在所有函数定义外)显示。Variable definitions, like declarations, can appear at the internal level (within a function definition) or at the external level (outside all function definitions). 函数定义始终会在外部级别显示。Function definitions always occur at the external level. 函数定义中进一步讨论了函数定义。Function definitions are discussed further in Function Definitions. 函数原型中介绍了函数原型。Function prototypes are covered in Function Prototypes.

请参阅See Also

源文件和源程序Source Files and Source Programs