Fun(int x) returns an int-correct.
(2) 2) Do you have to write the fun (int x) parameter type int?
Answer: It is related to the compiler. MS VC++ 6.0 can be omitted, and the default is int type.
For example:
# include & ltstdio.h & gt
fun(x){ return x * x; }
main(){
int y = 3;
printf("%d ",fun(y));
}
Output 9
-
Old-fashioned programs, parameter types are declared after parentheses, and types are not written in parentheses:
# include & ltstdio.h & gt
Floating fun (x)
Floating x;
{ return x * x}
main(){
float y = 3;
printf("%f ",fun(y));
}
-
(3) Function prototype declaration can only write types, not parameters, such as:
float fun(int,int);
-
(4) It is suggested to write the return type, parameter type and parameter name correctly.