i wrote a code structured like this
int function(){
int i, counter = 0;
for(i=INTEGER; i>0; ++counter, --i){
if(condition){
//do stuff
i+=2;
continue;
}
if(condition){
//do stuff
i+=35;
continue;
}
if(condition){
//do stuff
continue;
}
if(condition){
//do stuff
continue;
}
}
return counter;
}
I have problems to fully understand the mechanism of increment of the variables as parameters of for cicle. In the case above:
- How it's possible that the
i
variable increases and decreases work well, instead thecounter
variable at the return has only1
increase? - It's possible?