Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
For loop
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Use as infinite loops=== {{Further|Infinite loop}} This C-style for-loop is commonly the source of an [[infinite loop]] since the fundamental steps of iteration are completely in the control of the programmer. When infinite loops are intended, this type of for-loop can be used (with empty expressions), such as: <syntaxhighlight lang="c"> for (;;) //loop body </syntaxhighlight> This style is used instead of infinite {{code|while (1)}} loops to avoid a type conversion warning in some C/C++ compilers.<ref>{{cite web |title=Compiler Warning (level 4) C4127 |url=http://msdn.microsoft.com/en-us/library/6t66728h.aspx |publisher=Microsoft |access-date=29 June 2011}}</ref> Some programmers prefer the more succinct {{code|for (;;)}} form over the semantically equivalent but more verbose {{code|while (true)}} form.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)