difference between initialization for statement counter before and in for?

Viewed 39

what is the difference between implementations of the for loop:

between

int i;

for (i = 0; i < length; i++)
{ 
    // code
}

and

for (int i = 0; i < length; i++)
{
    // code
}
1 Answers

Well, the only difference is that you declare and define the variable i on the same line. It's rare to see the first example used in actual code bases.

Related