I am not sure that this is even possible. From all the examples I have seen, the array is defined within the { } brackets, but in my case it is not much possible.
What I am trying to do is keep this in my drawing function to draw multiple circles that slowly increase in size.
What I am getting by using a debugger is the static array is being reset every time the loop hits.
I have also tried something like static Rect rc[5] = {}
void fun_called_every_five_seconds() {
static Rect rc[5];
for (int i = 0; i < count; i++) {
int x = rand()%400;
int y = rand()%400;
int r = rand()%200;
rc[i] = Rect (x,y,r,r);
}
rc[0].X += 50;
// I check value of rc[0].X right here
}
staticarray inside a function, or is thestaticin the namespace scope? Please give a minimal reproducible exampleforloop will execute every time you call the function.static int = 5;static int s_something = 5;only works because it's initialization, you can't reinitialize and so the value won't "switch back" if it's been re defined somewhere else.