Hello all
I have been learning C for about 3 - 4 weeks now and I'm in need of some help.
I am trying to write a function that will give you the sum of selected integers in an array with a value of 20. I can make it give me a total for all of the intergers but not when i select certain integer positions, ie: say array positions 0 to 4 or array positions 15 to 19.
This is what I have so far
Function Protocol
int sum(int[], int, int);
Function Definition
int sum(int num_array1[], int start, int end)
{
int total=0;
for(int a=start; a<=end; a++)
{
total = total + num_array1[a];
return(total);
Thanks for any suggestions