Current location - Quotes Website - Personality signature - How to declare functions in C language
How to declare functions in C language
Define function

The general form of function definition in C language is as follows:

Return_type function name (parameter list)

{

Function body

}

In C language, a function consists of a function header and a function body. All components of the function are listed below:

Return Type: Functions can return values. Return_type is the data type of the function return value. Some functions perform required operations without returning a value. In this case, return_type is the keyword void.

Function Name: This is the actual name of the function. The function name and the parameter list together constitute the function signature.

Parameters: Parameters are like placeholders. When the function is called, a value is passed to the parameter, which is called the actual parameter. The parameter list includes the type, order and quantity of functional parameters. Parameters are optional, that is, the function may not contain parameters.

Function body: The function body contains a set of statements that define the tasks performed by the function.