Home > Back-end >  A beginner for help
A beginner for help

Time:09-21

#include

Void main ()
{
Int a, [10].


Int the sum (int [b]);

Printf (" input the number 10: \ n ");


for(int i=0; I<10; I++)
{
The scanf (" % d ", & amp; A [I]);
}


Printf (" the even and=% d ", sum);
}
Int the sum (int [b])
{

Int I, temp=0;

for(i=0; i<10; I++)
{
If (b [I] % 2==0)

+=b \ [I];


}
Return temp.
I this program to perform an array of the even and, don't know why the results have been wrong, is I have a problem with the parameters of the printf sum of
}

CodePudding user response:

Because there is no incoming parameters, the sum is only print the sum function address

CodePudding user response:

Printf (" even and=% d ", sum);
To printf (" the even and=% d ", sum (a));

CodePudding user response:

Printf (" the even and=% d ", sum);
You this sentence is to want to call a function sum, a function call you have to use this format: the function name (function argument)

CodePudding user response:

refer to the second floor wjher response:
to printf (" the even and=% d ", sum);
To printf (" the even and=% d ", sum (a));

No change to a no just don't know what to change to split head didn't come up with a

CodePudding user response:

@ _______ references 4 floor response:
Quote: refer to the second floor wjher response:

Printf (" even and=% d ", sum);
To printf (" the even and=% d ", sum (a));

No change to a no just don't know what to change to split head didn't come up with a

Ok, I've tried
  • Related