I understand how to sum all the numbers in an integer array but how can I sum up just half of the numbers in the array like just the top half or just the bottom half? Any suggestions would help, Thank you!
Printable View
I understand how to sum all the numbers in an integer array but how can I sum up just half of the numbers in the array like just the top half or just the bottom half? Any suggestions would help, Thank you!
Well... how do you sum all the numbers an integer array? Show your code snippet.
something like this:
Code:
int SumofAll (int Array[], int size)
{
int total = 0;
for (int i = 0; i < size; i++)
total+= Array [i];
return total;
}
There is no difference between
total = SumofAll( myArray, 10 );
and
total = SumofAll( &myArray[0], 10 );
Can you adjust the index and count now?