I have a function which does something using a static variable in it . Lets call this "void calledFunction () "
In the main loop, I have atleast four other functions which need to call the " calledFunction()" and in no particular order.
Now every call to the calledFunction() is going to alter the static variable in it. If i dont want this to happen and retain four different copies should I create three more clones of " calledFunction(); ?
This is the perfect case for writing your function as a class. Then each instance of the class can have its own static variable, and they are all kept separate.
If you want each calling function to have its own copy of the static variable, pass the static variable by reference. This allows calledFuntion() to change the value but a different value for each caller.