Hi,
I am using Microsoft Visual C++ and I want to declare a variable and initialise it to zero the first time a function is called.
To this end I created a condition to check if it the first time through.
I tried to do the following:
if(first)
{
int j=0;
}
I then go on to use j BUT the compiler doesn't like this....
I am getting;
error C2065: 'j' : undeclared identifier
Is there a way around this or am I going about this totally wrong?
I am using Microsoft Visual C++ and I want to declare a variable and initialise it to zero the first time a function is called.
To this end I created a condition to check if it the first time through.
I tried to do the following:
if(first)
{
int j=0;
}
I then go on to use j BUT the compiler doesn't like this....
I am getting;
error C2065: 'j' : undeclared identifier
Is there a way around this or am I going about this totally wrong?