Formal and actual parameters must one do?
Users questions: I see Laotan that the c programming function goes before the sections are formal and actual parameters one appearance, but I see the following procedure on the loss of: f (inta) {autointb = 0; staticc = 3; b = b +1; c = c +1; return (a + b + c);} main () {inta = 2, i; for (i = 0: i 3: i + +) printf ("% d", f (a));} I want to know why the parameter is a? But in the f function in the variables b, c are used in the time and also return back Uses a + b + c, so I think the parameter should be a, b, c ah? Function returns the value of the expression and return parameter in the table is anything to do ah? Which master to help me answer what ah? Thank you!
Experts answer: because the programmers feel that this function requires only one parameter can be passed Operation, it is only one parameter, the variable b, c is the function f in the internal variables do not need input from the outside. Function in the variables used are not all passed from the outside, and some only need enough processing within the function, it can reduce user input and computation. In the above example you In, b and c are only defined within the function and process, does not need external program input and operation. Or programmer-defined parameter list in the final analysis, you can write to write the number on how many, but to be arguments when called with the parameters you define a list of correspondence, no more, no less . Function returns the value of the expression and return parameter in the table is not related to the relationship between the just return a value .... return it, in your above example is to return a + b + c value of this expression, This statement does not return there with the necessary link