If I declare a variable, such as an int and set it equal to an initial value, will it get reset if it is in a loop to it's initial value on each iteration. For example, consider the following code:
Now if I want j to get set to 0 each time the loop iterates, will it do so with the above example? Obviously, a simple solution would just be to split up the declaration and instantiation into seperate lines. But I was curious what the deal is.
Thanks.
Code:
for(int i=0; i<whatever; i++) {
int j = 0;
some other code that changes the value of j...
}
Thanks.