Summation of an array using pointers
I need some help getting unstuck on a line of my program.
Please look at the attached file.[CODE]
//***Question: find the average of 125 randomly generated integers between 30 and 40***
//***must display the answer in the following type XX.X and must incorporate pointers***
#include<stdio.h> //printf,scanf
#include<stdlib.h>
#define SIZE 125
#define NUM 11
void random(int *);
void sum(int *);
int main()
{
int array125[SIZE];
random(array125);
sum(array125);
return 0;
}
//****end main
//*****begin random
void random(int *xptr)
{
int count,ran;
for (count=0;count<SIZE;count++){
ran=30+rand()%NUM;
*(xptr+count)=ran;
}
}
//****End Random
//***Begin Sum
void sum(int *aptr)
{
int count;
int summ=0;
for (count=0;count<SIZE;count++)
*(aptr+count)+summ==summ; //this line has a probelm
printf("\n%d\n",summ); //returns a zero value
}
/*The first function random works fine. I am stuck on adding up the values in the array125[SIZE].
I know that I will have to divide the sum by 125. I am just stuck on formallities in the C language
Will a kind soul point me in the right direction?*/