Home > Back-end >  Novice c language programming, the trouble, and have a look
Novice c language programming, the trouble, and have a look

Time:02-16

Topic is: write a one-dimensional array with n elements sum function sum (), require the use of Pointers in function parameters, and calls to this function in the main function, realization with 10 elements in a one-dimensional array sum,
I wrote: int main ()
{
Int the sum (int * p, int n);
Int a [10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 5};
Int n=10;
The sum (a, n);
Printf (" \ n the array and for % d ", sum);
}
Int the sum (int * p, int n)
{
int i;
Int sum=0;
For (I=0; I & lt; n; I++ p++)
The sum +=* p;
return sum;
}
There is no error, but the results are not

CodePudding user response:

Solve the solved

CodePudding user response:

Help junction post + points

CodePudding user response:

"1 + ceng points

If moderators feel I this is in the water, please direct messages me,
  • Related