# need help in C



## frogonfloor (Mar 5, 2008)

*need help in C ( using for loop without condition in bracket )*

Hi friends i want to ask one question . this is realy crazy question but still i am asking
can we use for loop without giving any condition in bracket 
i mean for() nothing in bracket .


----------



## Pathik (Mar 5, 2008)

Nope.. U can use it without any conditions but like this
for(;
{}
it ll be an infinite loop


----------



## frogonfloor (Mar 5, 2008)

for(;
{}


It is giving syntax error . no matter it is infinite loop but it should run .


----------



## Pathik (Mar 5, 2008)

damn the  smiley.. use

```
for(;;){}
```


----------



## casanova (Mar 6, 2008)

Or while (1)


----------



## aditya.shevade (Mar 6, 2008)

why do you want it though? 

The best way to create an infinite loop is, 
	
	



```
while(TRUE)
```


----------



## mehulved (Mar 6, 2008)

casanova said:


> Or while (1)





aditya.shevade said:


> The best way to create an infinite loop is,
> 
> 
> 
> ...


Don't both mean the same?


----------



## Faun (Mar 6, 2008)

Pathik said:


> Nope.. U can use it without any conditions but like this
> for(;
> {}
> it ll be an infinite loop


lol


----------



## aditya.shevade (Mar 6, 2008)

mehulved said:


> Don't both mean the same?



Yeah they mean the same.... I just use TRUE and FALSE because it is easier to understand than while 1 or 0. Theoretically, you can use any non zero positive integer to indicate TRUE.


----------



## frogonfloor (Mar 6, 2008)

friends i said there should not be any condition in bracket  and it should run . no matter what the output is . but i think 





> for(;{}


is right


----------



## QwertyManiac (Mar 6, 2008)

What do you mean you think? Why don't you try it first before asking? Or was this a test question?


----------



## frogonfloor (Mar 6, 2008)

i tried this one and thanks to Pathik and others for helping .

does one one know how to Obfuscate c code


----------



## QwertyManiac (Mar 6, 2008)

I guess doing a near-proper disassembly of the code should give you enough obfuscation?

Or... I might just be repeating a heard bluff here.


----------



## frogonfloor (Mar 7, 2008)

can u explain it a bit more


----------



## FilledVoid (Mar 7, 2008)

```
for(;;)
{

}
```

Any part of the for statement can be left out . However the semicolons must be used in any case. The above gives you an infinite loop cause there is no condition being tested for , no variable being initialized as a counter in it or incrementing / decrementing the counter in it. Unless you know what you were doing you would not use this syntax in one of your programs.


----------



## frogonfloor (Mar 7, 2008)

thanks for explaning .
can u tell me how to Obfuscate c code


----------

