answersLogoWhite

0


Best Answer

Everywhere in the code when there is no 'break', the running will continue with the next instruction. Example:

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

printf ("i=%d: ", i);

switch (i) {

case 2: printf ("two ");

case 1: printf ("one ");

case 0: printf ("zero ");

}

printf ("\n");

}

The output:

0: zero

1: one zero

2: two one zero

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What will happen if you do not use break statement?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can break statement be used without any loop?

The Break statement should generally get executed in some loop or switch statement. The below code will give compiler error. void main() { printf("12"); break; printf("14"); }


How can a loop be structured so that it terminates a statement in the middle of its block?

I think you want to use statement break.


What is the use of break in c programming?

The break statement is used to exit the nearest enclosing scope. Control passes to the first statement that comes after that enclosing scope.


How do you break a loop in a switch case statement?

using break; statement


Why break statement is optional in c plus plus?

You use a break statement to end execution of the enclosing iterator (loop) or switch statement. If omitted at the end of a case label, execution continues to the next case label, including the default case, until a jump statement is encountered (break, goto or return) or the switch statement falls from scope. Sometimes this can be desirable behaviour, thus the use of break is optional. A break statement is always optional at the end of the default case, or the last case label. Its usage in loops is always optional, to allow a loop to end prematurely regardless of the conditional expression that controls the loop.


What is the purpose of break statement in c?

The break statement exits control of the innermost for, while or do-while loop, or switch statement.


Difference between break and continue statements in wml?

Break statements:-its terminates the current while or for loop and continue the program execution from the statement following the terminated.NOTE:-note that it is wmlscript syntax error to use the break statement outside of while or a for statements.example;Breakstatement:Break;Continue statement:-this statement terminate execution of a block of statementin while or for loop and continues execution of loop with the next iteration.note that the continue statement does not terminate the execution of loop and also is wmlscript syntax error to use the break statement outside of while or a for statements.-> in while loop, it jumps back to the condition.-> in for loop,it jumpsto the update expression.syntax:continuestatement:continue;


The break statement is required in the default case of a switch selection structure?

Ends the case statement. Without it, any code after where the break; is supposed to be will get executed as well until it does encounter a break; or the end of the switch.Code Example:char cTest = 'a';switch(cTest) {case 'a':/* Code here gets executed. */case 'b': //* Code here gets executed. */case 'c':/* Code here gets executed. */break;case 'd':/* Code here won't be executed. */default:/* Code here won't be executed. */}


Who can used to exit from a loop?

If you meant 'what can be used' then it is statement break.


Can you use conditional operator in cout statement?

Yes, but 'cout' is not a statement! Examples for statements: null-statement, block, expression, if-else, while, do-while, for, continue, switch, break, return.


Why you use if and else statement in c language program?

There is no "elseif" statement in C. You can only use "else" and "if" separately. This is a good reason for switch/case/break.


What is the purpose of Continue and break statement in C?

The break statement is frequently used to terminate the processing of a particular case within a switch statement. Lack of an enclosing iterative or switch statement generates an error.Within nested statements, the break statement terminates only the do, for, switch, or whilestatement that immediately encloses it. You can use a returnor goto statement to transfer control elsewhere out of the nested structure.This example illustrates the break statement:#include int main() { char c; for(;;) { printf_s( "\nPress any key, Q to quit: " ); // Convert to character value scanf_s("%c", &c); if (c == 'Q') break; } } // Loop exits only when 'Q' is pressed