Who cares how many times they initialized i? They are supposed to initialize twice. It's called 'variable reuse'. There is no point in having seperate variable names when all you're doing is using it in two consecutive loops, neither of which have any effect on the other.Originally posted by PuhFENDanT
if your code is exact then Why didn't you notice the fact that you initialized i twice wow what a bone head
For that matter, this also has no harm:
It doesn't matter that I've initialized it in two places. All that matters is that when I want to use it in the loop, I initialize it to whatever it needs to be. Since nothing else in the code is dependant on the value of foo going into the loop, it doesn't matter what it contains before I initialize it the second time.Code:int foo = 0; for( foo = 0; foo < bar; foo++ )
Quzah.