Function: Complete a specific function code block
Function: Manage the Code
Advantages of the function: improve the readability of the Code
Improve Code reusability
Improve Code maintainability
Function: Function name cannot be defined repeatedly
To give a meaningful name to the function
Function feature: Only the call will execute
Format of function definition
Formal parameter list
return type function name (parameter type parameter name, parameter type parameter name,...)
{
Statement
....
return xxx;
}
How to define a function:
1, according to function functions to give a meaningful name to the function
2. Determine the value of some benefits that need not be descendants
3. Determine what type of data needs to be returned to the function caller
4. Complete function function
void when a function has no return value, declare the return value type of the function as void
When the return value type of the function is void, the return statement can be omitted
When do I need formal parameters: when we have a function, we can't be sure of the data, then we need to tell us.
C Language: Basic concepts of functions