B
bobby
hello group,
what does for( ; ; ) mean in C program
Thanks
what does for( ; ; ) mean in C program
Thanks
bobby said:what does for( ; ; ) mean in C program
This is a loop.
Do no initializations.
Do not test any condition to see whether you should continue.
Do not do anything after the end of a loop before the beginning
of the next loop through.
In summary: for(;is another way of writing while (1)
which is an infinite loop (unless broken out of somewhere
in the middle.)
bobby said:hello group,
what does for( ; ; ) mean in C program
while (1)
hello group,
what does for( ; ; ) mean in C program
Thanks
sid said:A 'while()' loop is equivalent to 'for(;'
while() is not valid syntax. I think you mean that a while(1)
loop is equivalent to for(;.
Ben Pfaff:
But the extra-paranoid don't use it coz they don't want 1 to be evaluted
upon every iteration ;-)
Harald van Dijk said:Some people avoid using while(1) because they have to deal with broken
tools that give warnings for while(1) that they don't give for for(;.
Michal Nazarewicz said:for(;is also one character shorter then while(1).
![]()
I always thought it meant:
while(27)
I guess it depends on what part of town you're from.
bobby said:hello group,
what does for( ; ; ) mean in C program
Thanks
runner said:#define ever (;
for ever
If your goal is to be cute, by all means go ahead and use that macro.
If your goal is to write understandable and maintainable C, please
don't.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.