[Solved] Why for loop does not run by other than int variables? [closed]


You can use a for loop with integer variables, floating-point variables, even no variables at all.

int i;
for(i = 0; i < 10; i++) continue;

float f;
for(f = 0.0; f < 5; f += 0.5) continue;

for(;;) break;

But see What Every Computer Scientist Should Know About Float-Point Arithmetic for why you should think twice before using example 2.

solved Why for loop does not run by other than int variables? [closed]