1 #ifndef STATS_HPP_INCLUDED 2 #define STATS_HPP_INCLUDED 22 void init(
int aLength){
26 array=(TYPE*)malloc(
sizeof(TYPE)*length);
29 printf(
"Error while allocating array\n");
30 memset(array, 0,
sizeof(TYPE)*length);
44 return bufferFull ? length : pointer;
46 void setLength(
int aLength){
50 double add(TYPE newElement){
52 array[pointer]=newElement;
58 average=sum/(double)(1+pointer);