473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

what does "for( ; ; )" mean in C program

hello group,
what does for( ; ; ) mean in C program

Thanks
Feb 1 '08 #1
13 10496
In article <25**********************************@j20g2000hsi. googlegroups.com>,
bobby <bs*****@gmail.comwrote:
>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.)
--
'Roberson' is my family name; my given name is 'Walter'.
Feb 1 '08 #2
On Feb 1, 3:52 pm, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
In article <25dd47d5-b599-4ed0-8f9d-9b84936a8...@j20g2000hsi.googlegroups.com>,

bobby <bsim...@gmail.comwrote:
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.)
--
'Roberson' is my family name; my given name is 'Walter'.
Thank a lot
Feb 1 '08 #3
bobby wrote:
hello group,
what does for( ; ; ) mean in C program
while (1)

Feb 1 '08 #4
In article <60*************@mid.individual.net>,
Martin Ambuhl <ma*****@earthlink.netwrote:
>bobby wrote:
>hello group,
what does for( ; ; ) mean in C program

while (1)
I always thought it meant:

while(27)

I guess it depends on what part of town you're from.

Feb 1 '08 #5
sid
On Feb 2, 1:48*am, bobby <bsim...@gmail.comwrote:
hello group,
what does for( ; ; ) mean in C program

Thanks
It also means for(;1;);
A 'while()' loop is equivalent to 'for(;;)'
Feb 2 '08 #6
sid <ki***********@gmail.comwrites:
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(;;).
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
Feb 2 '08 #7
Ben Pfaff:
sid <ki***********@gmail.comwrites:
>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(;;).

But the extra-paranoid don't use it coz they don't want 1 to be evaluted
upon every iteration ;-)

--
Tomás Ó hÉilidhe
Feb 2 '08 #8
Harald van Dijk <tr*****@gmail.comwrites:
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(;;).
for(;;) is also one character shorter then while(1). :P

--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
Feb 2 '08 #9
"Michal Nazarewicz" <mi****@tlen.plwrote in message
news:87************@erwin.mina86.com...
Harald van Dijk <tr*****@gmail.comwrites:
>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(;;).

for(;;) is also one character shorter then while(1). :P
:^)

Feb 2 '08 #10
On Feb 2, 2:43 am, gaze...@xmission.xmission.com (Kenny McCormack)
wrote:
In article <60hgo6F1q946...@mid.individual.net>,
Martin Ambuhl <mamb...@earthlink.netwrote:
bobby wrote:
hello group,
what does for( ; ; ) mean in C program
while (1)

I always thought it meant:

while(27)

I guess it depends on what part of town you're from.
nah .. its actually while(42) :P
Feb 2 '08 #11

"bobby" <bs*****@gmail.comha scritto nel messaggio
news:25**********************************@j20g2000 hsi.googlegroups.com...
hello group,
what does for( ; ; ) mean in C program

Thanks
#define ever (;;)

for ever

Feb 3 '08 #12
"runner" <emb@ddedwrites:
"bobby" <bs*****@gmail.comha scritto nel messaggio
news:25**********************************@j20g2000 hsi.googlegroups.com...
>hello group,
what does for( ; ; ) mean in C program
#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.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Feb 3 '08 #13

"Keith Thompson" <ks***@mib.orgha scritto nel messaggio
news:87************@kvetch.smov.org...
"runner" <emb@ddedwrites:
>"bobby" <bs*****@gmail.comha scritto nel messaggio
news:25**********************************@j20g200 0hsi.googlegroups.com...
>>hello group,
what does for( ; ; ) mean in C program
>#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.
I'm being cute, i don't need that macro. But it does its job in explaining
what happens when no expression is provided.

--
Feb 4 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some...
0
by: Claudio Grondi | last post by:
Hi, I have just by chance discovered, that Microsoft research works on a kind of programming language called AsmL, and I'm just curious if AsmL, which is using same concept of significant...
5
by: Steven T. Hatton | last post by:
I've seen people here write that C++ doesn't support modules. What does that mean? 'Module' is a very nebulous term in my book. It probably means something quite different to me than what it does...
9
by: Marek Kurowski | last post by:
Yo! What mean when program is ALPHA or BETA version? I suppose it is not release version of program, but I don't know what it exactly mean. What it mean in your opinion? Marek Kurowski
6
by: Juan Romero | last post by:
Guys, Sometimes when you want to open a file, the file is locked for editing for some reason. You are able to see the contents of the file (depending on the program you are using) but you are...
39
by: utab | last post by:
Dear all, Is there a clear distinction how to decide which functions to be members of a class and which not How is your attitude (Your general way from your experiences ...) "If the...
5
by: chandanlinster | last post by:
consider the program, /*********************************************************/ int main() { int a; printf("a = %u\n", a); printf("*a = %u\n", *a); return 0; }
4
by: chandanlinster | last post by:
hello everybody, as i was going through the "printf" man page, i came across this statement. printf("%*d", width, num); what does "*" mean?
8
by: nguillot | last post by:
Hello. If I have the following classes: class B {}; typedef B tB; if A is: class A
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.