You can do this in C99:
But what if I'm not writing C99 code and want to keep the same behavior? Couldn't I just do this:Code:for(int i=0;i<100;i++){ }
That way, if I have for loops later in the code I don't have to worry about the fact that I already declared i as an int. I might want to declare it as another type later.Code:{int i; for(int i=0;i<100;i++){ }}
Is this a bad idea?