Ok so, I know that if you declare a variable inside an if statement, then the variable will exist only inside the if block. But what about in loops? If I do something like:
Is it efficient? I thought that maybe it could declare multiple times the variable and be inefficient actually, but I'm not sure.Code:for(whatever;bla;etc.) { int x; bla bla bla...; }
Thing is that I want to declare a variable that will only be used inside the for. I have seen the declaration inside the for parentheses:
But the compiler gives me a warning, something about not C99.Code:for(int x; bla; bla)
Thanks.