First, the classification of functions
1) The entry of the main function program
2) functions in the C standard library such as scanf (), printf (), etc.
3) developer-defined functions
Ii. definition and declaration of functions
Declaration of the function:
return value type function name (parameter 1, parameter 2, ...)
For example
int sum (int a, int b);
Or you can simply save a littleint sum (int, int);
Definition of the function:
int sum (int a, int b) {
return a + B;
}
Note: C-language functions are sequential, unlike Java functions, where all functions must be declared before the main function
iii. parameters of the function
when defining a function, the variable defined in () after the function name is called a formal parameter (formal parameter), and the value passed in when the function is called is called the actual parameter (argument).
For example, the sum () function above
int main (int argc, const char *argv[]) {
sum (in); //1 2 is a/b parameter when the sum is defined as the argument
}
C Language Functions