Write a function called arraysum that takes two arguments: an integer array and the number of elements in the array. HAve the function return as its result the sum of the elements in the array.
Write a function called arraysum that takes two arguments: an integer array and the number of elements in the array. HAve the function return as its result the sum of the elements in the array.
So what have you tried so far?
We don't hand out code... you need to make the first effort.
Work the solution until you hit problems, post your code and
we'll see what we can do.
I will give you one hint through: It involves a for() loop.
i don' t know though if your array is one or two dimension. But, you must access all the array and each time in the loop have this:
sum =0;
loop{
sum = sum + A[ i ];
}
Your opinion?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.