A
Angus
Hello
I have a function which takes samples and creates an average value.
The function needs to know the number of instances passed until a
'window' value is reached. The window value is 5 so in my calling
function I currently do this:
static long iterations = 0;
++iterations;
sample_average(x, y, iterations);
sample_average is called elsewhere in the program so I can't put the
static long declaration in there. It just looks bad style to me so
was wondering if anyone had a better suggestion for how to handle
this?
In addition, when iterations overflows to 0 then will start count to 5
again.
Puzzled Me.
I have a function which takes samples and creates an average value.
The function needs to know the number of instances passed until a
'window' value is reached. The window value is 5 so in my calling
function I currently do this:
static long iterations = 0;
++iterations;
sample_average(x, y, iterations);
sample_average is called elsewhere in the program so I can't put the
static long declaration in there. It just looks bad style to me so
was wondering if anyone had a better suggestion for how to handle
this?
In addition, when iterations overflows to 0 then will start count to 5
again.
Puzzled Me.