Say I want to do something like this to increment a int array every time I call f():
void f()
{
static int v[100]={1,2,3...100};
for (int i=0; i<100; i++) v[i]++;
}
i.e. I want:
first call f(): v[100]={1,2,3...100};
second call f(): v[100]={2,3,4...101};
...
apparently the following will not do it:
void f()
{
static int v[100]; for (int i=0; i<100; i++) v[i]=i+1;
for (int i=0; i<100; i++) v[i]++;
}
Not sure how to achieve it. Thanks!
forloop before you increment it with the second?