I'm having something like this:
void test(int iter){
int i;
if(iter>3){
i=5;
printf("%d",i);
}else{
printf("%d",i);
}
return;
}
int main(){
test(5);
test(2);
return 1;
}
This is just for example. Is it possible when called by main variable i
hold value of 5 (in memory) if at least iter
is greater than 3?
I know that it is not normal. But I have a function in my program (I don't have static var that is doing this) which does it. So maybe the address where this variable is initialised each time the same (so I'm getting the old value)? Or what does happen? I don't want to hold the old value or something. I'm just curious: how is this possible?