Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   my compilation error (http://www.go4expert.com/forums/my-compilation-error-t23927/)

vidhi gupta 20Nov2010 00:13

my compilation error
 
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 20Nov2010 15:36

Re: my compilation error
 
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);
}



All times are GMT +5.5. The time now is 03:43.