What is while(1) and how it works???
What is while(1) loop?
Collapse
X
-
What is while(1) loop?
Last edited by Stewart Ross; Dec 16 '12, 01:14 PM. Reason: Changed wording from obvious student homework question - had this not been answered it would have been deleted as against site rulesTags: None -
while(1) is an infinite loop. You can use this to implement a function that needs to restart itself. A menu is a good example. Or a server.
No code example as this may be a homework assignment. -
-
its an infinite loop... and the statements inside it will always be executed...
Example:
while(1)
{
Statement 1;
Statement 2;
.
}
in above example these statements will be executed forever... and will never stops... You may use an "if condition" and inside it (i.e if condition) a break statement to terminate loop in some specific situation...Comment
Comment