Mega Code Archive
Calculating a floating-point average using pointers
#include
#include
#include
int main()
{
double *values = NULL;
double sum = 0.0;
int capacity = 5;
int j = 0;
values= (double*)malloc((capacity)*sizeof(double));
if(values == NULL){
printf("Memory allocation failed. Terminating program.");
}
for(j=0;j