hi,
i have some code which is taking a value of how many moves a function is making to an array of numbers, and displaying it but basically, when i call the function initially, it will give the correct number of moves, when i call it again its adding the value to the previously displayed number unless i close the whole program down and start again. how do i reset the value each time i call the function.
i know its a very easy question for someone with a brain but i am still building mine and would really appreciate the help.
thanks
this is the code which is troubling me
long moves(int mode){
// adds to i in counting mode (>0), returns i
static int i=0;
if(mode)
i+=mode;
return i;
}