>> *(aptr+count)+summ==summ; //this line has a probelm
Try
summ = *(aptr+count)+summ;
And just a pointer on the use of functions:
Code:
int
sum(int array[], int count)
{
int i, amount = 0;
for(i = 0; i < count; ++i)
amount = amount + array[i];
return amount;
}
Now you can actually use the function in another program, without having to drag that macro 'SIZE' everywhere you go (and having to change it!).
Also, notice the function returns something useful. Then you can even do:
Code:
int
average(int array[], int count)
{
return sum(array, count) / count;
}