posted 22 years ago
From JavaRanch RoundUp :
int i;
for( i=4, int i=6; i<10; i++ )
ANS : NO
EXPLANATION:
You can declare or intialize more than one variable in for loop, but you cannot
mix declarations with initializations.
I tried out the below :
Following compile fine
1. for ( int i,j=1; i<10,i++ )
2. int i,j;
for( i=0,j=1; i<10, i++ )
Following give error :
1. for ( int i, int j=1; i<10,i++ )
Is there any other thing to be taken care in the initialization
portion of the for loop ?