PDA

View Full Version : need help in C


frogonfloor
05-03-2008, 10:19 PM
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
05-03-2008, 10:34 PM
Nope.. U can use it without any conditions but like this
for(;;)
{}
it ll be an infinite loop

frogonfloor
05-03-2008, 10:42 PM
for(;
{}


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

Pathik
05-03-2008, 11:15 PM
damn the ;) smiley.. use
for(;;){}

casanova
06-03-2008, 12:15 PM
Or while (1)

aditya.shevade
06-03-2008, 12:52 PM
why do you want it though?

The best way to create an infinite loop is, while(TRUE)

mehulved
06-03-2008, 05:45 PM
Or while (1)



The best way to create an infinite loop is, while(TRUE)
Don't both mean the same?

T159
06-03-2008, 06:11 PM
Nope.. U can use it without any conditions but like this
for(;;)
{}
it ll be an infinite loop
lol :D ;)

aditya.shevade
06-03-2008, 07: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.

frogonfloor
06-03-2008, 08: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 for(;;){} is right

QwertyManiac
06-03-2008, 10:34 PM
What do you mean you think? Why don't you try it first before asking? Or was this a test question? :?

frogonfloor
06-03-2008, 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
06-03-2008, 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.

frogonfloor
07-03-2008, 07:25 AM
can u explain it a bit more

FilledVoid
07-03-2008, 11:01 AM
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
07-03-2008, 09:01 PM
thanks for explaning .
can u tell me how to Obfuscate c code