CodePudding user response:
Can have a look at the parameter pass by value and the difference between the referenceVoid the mul (int n) is modified to void the mul (int & amp; n)
CodePudding user response:
The function has no return value, want to use the int the mul (int n)CodePudding user response:
Not very normal, two mistakes, 1: n the mul is parameter, not a pointer or reference, value cannot be passed out. 2. The printf, no address, you this is the address of print n, not values. (3) change a compiler, for example vs2017, don't use this ancient compilersCodePudding user response:
Not return a value, that is, a custom function will return the value to return to the main function, so the main function of n or a random value.The method of modifying:
int the mul (void)
{
Int I, n=1;
For (I=1; i <10; I++)
N=n * I;
Return n.
}
Int main (void)
{
int n;
N=the mul ();
Printf (" % d \ n ", n);