Home > Article > Backend Development > What two parts does the C language function consist of?
In C language, a function generally consists of two parts: a function header and a function body. The function body is the entirety of all the codes that define a function in the programming language. The function header refers to the function. All parts before the body are used in the fields of mathematics and programming, and their function is to give the return type of the function.
#In C language, a function generally consists of two parts: a function header and a function body.
The function body is the entirety of all codes that define a function in a programming language. The function body is a number of statements enclosed in curly braces, which complete the specific functions of a function. The front part of the function body is the definition and description part, followed by the statement part. The function declaration and function body together form the function definition.
The function header refers to all parts before the function body. It is used in the fields of mathematics and programming. Its function is to give the return type of the function. In a function definition, all parts before the function body are called function headers, which give the function prototype information such as the return type of the function, the order and type of each parameter, etc., so when no function prototype description statement is specifically given, , the system obtains the function prototype information from the function header.
Related introduction:
Function body usage example:
main(){printf()();printf()();}/
/The function body is the set of all statements within the curly braces, including the curly braces
The prototype statement of a function is a copy of its function header. Of course, the statement must be added at the end followed by the terminator semicolon. . There are also subtle differences between function prototype statements and function headers.
In the function prototype statement, each parameter in the parameter list is allowed to retain only the parameter type and omit the parameter name, and if the parameter name is used, it is also allowed to be different from the corresponding parameter name in the function header.
Recommended tutorial: "c Language Tutorial"
The above is the detailed content of What two parts does the C language function consist of?. For more information, please follow other related articles on the PHP Chinese website!