answersLogoWhite

0

The keyword "break" will immediately terminate the enclosing loop.

Otherwise using conditions in the loop will terminate the loop once the condition becomes false.

eg

int i = 0;

int b =0;

for(i ; i < 3; i ++){

b++;

}

Will increment i and b on each iteration. The loop will terminate when i >= 3 (when the condition i < 3 becomes false).

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Syntax of for loop in c language?

for(i=0;i&lt;=0;i++)


Easy to use loop in c language?

Yes.


What is purpose of break statement?

to terminate a loop.


What is difference between select Case statement and nested loop in c programming in UNIX?

UNIX has no bearing on the C language; it is cross-platform. There is no select/case in C, you probably meant switch/case. However, a switch/case is a conditional jump while a nested loop is a loop within a loop. Besides the C language they have nothing in common with each other.


Why you use semicolon to terminate the lines in C programming?

Because that is the defined statement terminator of the language.


What is the difference between for if-then and for loop?

a for loop is defined with an boolean expression to indicate when it should terminate. A for each loop iterates once for each item in a collection. for example, "for each (book in bookshelf)" will iterate once for each book on the bookshelf, providing access to the current book. a for loop is defined like "for (int i = 0; i&lt;10;i++)" meaning the loop will iterate as long as the condition is true (i &lt; 10), and will increment on each loop. Note: there is no 'for each' loop in C language, but there is a 'foreach' in PHP.


Why you use FOR LOOP in C language?

For LOOP is used, when you want to execute a specific block of code for specific number of times.


For loop in c language?

for(assigning initial value;condition;increment/decrement) { statement; }


What is iterations in c language?

An iteration is an instance of a structured loop statement (for, while or do-while).


Write 8085 assembly language program for BCD up counter and display using 8279?

loop: mvi c,59 dcr c mov a,c daa movc,a jnz loop end


C plus plus what do you do if im stuck in an infinite loop?

There are three ways out of a loop.1. Satisfy the loop ending condition2. Execute a break statement3. Terminate the programPerhaps you are not changing the value of the variable that is used in the loop ending condition. Perhaps you are using a variable, such as an unsigned int, decrementing it, and expecting it to go negative. Suggest you run the program in a debuger and step through the loop.


Does break statement terminate only the inner loop in c?

Yes. Break terminates only the innermost control structure, loop, switch, etc. If you want to break out of nested control structures, you can set a variable to induce a second break, or you can throw an exception.