I'm using VC++ 2010 with Windows 7 x64. I'm compiling all my code as C code.
I have a for loop like this:
for (i = 0; i < max; i++)
{
...
}
But when I run it, i
is being set to max
If I set i
to 0 in the first line of the for loop, it does change to 0, but at the end of the for loop, it does not go back up and check the condition, it just exits out of the loop.
Setting i
to 0 before the start of the for loop does not change this, neither does using an entirely different counter variable.
Here is the actual code being used:
indices = malloc (sizeof(short) * data.face_count * 3);
for (i = 0; i < data.face_count; i += 3);
{
indices[i] = data.face_list[i]->vertex_index[0];
indices[i + 1] = data.face_list[i]->vertex_index[1];
indices[i + 2] = data.face_list[i]->vertex_index[2];
}
EDIT: Changing it to a while loop makes it function normally, so it's something to do with that paticular for loop (all others work correctly).