I am quite new to C but have a lot of experience in C#. My college instructor told me that in "pure" C, it is wrong to initialize the loop variable inside the loops parantheses. He said that it runs because of the VS compiler. For some reasons, all the material in the presentation also shows loops with their loop variable declared outside the parantheses.
for (int i=0; i < 5; i++)
{
//He says that this is wrong, and you will lose points in tests for that
}
int i;
for (i=0; i < 5; i++)
{
//Says it should be done like that (i declared outside loop)
}
Does it really matter? Do some compilers fail to recognize it? Will I lose points on a test?