my compilation error

vidhi gupta's Avatar, Join Date: Nov 2010
Newbie Member
error 1:
Code:
for(int i=0;i<20;i++)
[problem: for statement missing]
error 2:
Code:
void pass()
{
char passw[20];
for(;;)
}
[problem:functions containing for are not explained inline]
ihatec's Avatar, Join Date: Sep 2010
Go4Expert Member
In first case the second statement is missing. You tried i<20; but you used entitity for less that.

In second case your function do nothing. It allocates memory for 20 chars, and then you tried some infinite loop but without any statement after it. When you use loops they must contain a statement that will execute for some number of times.
Code:
int i=0;
while(i<4)
{
      printf("%i", i);
      i++;
}
int i=0;
do
{
      printf("%i", i);
      i++;
}while(i>8);
int i;
for(i=0;i<10;++i)
{
     printf("%i",i);
}