473,382 Members | 1,204 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,382 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 10488
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 ;-)

--
Toms hilidhe
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.