DIGIT-ARC read-only archive · snapshot: July 23, 2026

need help in C

16 posts · originally from https://geek.digit.in/community/threads/need-help-in-c.81919/

F
frogonfloor Original post #1
Mar 5, 2008 at 10:19 PM
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
Pathik #2
Mar 5, 2008 at 10:34 PM
Nope.. U can use it without any conditions but like this
for(;;)
{}
it ll be an infinite loop
F
Mar 5, 2008 at 10:42 PM
for(;
{}


It is giving syntax error . no matter it is infinite loop but it should run .
Pathik
Pathik #4
Mar 5, 2008 at 11:15 PM
damn the ;) smiley.. use
Code:
for(;;){}
casanova
Mar 6, 2008 at 12:15 PM
Or while (1)
aditya.shevade
Mar 6, 2008 at 12:52 PM
why do you want it though?

The best way to create an infinite loop is,
Code:
while(TRUE)
aditya.shevade
Mar 6, 2008 at 7:07 PM
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.
F
Mar 6, 2008 at 8:53 PM
friends i said there should not be any condition in bracket and it should run . no matter what the output is . but i think
is right
QwertyManiac
Mar 6, 2008 at 10:34 PM
What do you mean you think? Why don't you try it first before asking? Or was this a test question? :?
F
Mar 6, 2008 at 10:37 PM
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 at 11:15 PM
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.
F
Mar 7, 2008 at 7:25 AM
can u explain it a bit more
F
FilledVoid #15
Mar 7, 2008 at 11:01 AM
Code:
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.
F
Mar 7, 2008 at 9:01 PM
thanks for explaning .
can u tell me how to Obfuscate c code