max() is not a function provided to you in the C language, but is defined by the programmer himself.
In the source code of the program you are looking at, the person who wrote the program defined a function named max. It is different from the main() function. main() is already defined in the C language function library. Main() has been given meaning, that is, it is the main function of every C program. And this max() is only defined by the person who wrote the source code.
Just like when you write a program, you can define variables at will, such as defining int
a; it just defines an integer variable named a, you can also define it as int
p>
b; Just changed his name. The meaning has not changed. You can completely rename this max() to num(), sum() and other functions, and change its name at will.
int
max(int
a, int
y) means:
First An int is used to define the max() function as an integer function, and max is the name of this function. The int
a and int
y in the brackets are the parameters of the max function. The meaning of the parameters is, for example, a function f in your mathematics, its The expression is: y=3x. I wrote this expression casually, so its function name is f, and its parameters are y and x. Of course, the nature of functions in mathematics and programming is completely different. int
a, int
y means parameter a is defined as an integer, and parameter y is also an integer.
Owner, do you understand?