Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Control structure of c language
1. 150990119011 – KAGZI MOHAMMAD UZAIR
150990119012 – ABHIJEET KHER
150990119013 – MALEK MOIN
150990119014 – TANMAY MANDALIYA
150990119015 – PRATIJEETSINH MANGROLIA
CONTROL STRUCTURE OF C LANGUAGE
BY : -
2. It is a two-way decision statement. depending on whether the value
of expression is 'true' or 'false', it transfers the control to a particular
statement.
7. We use if statement to choose one of the many alternatives. But as the
number of alternative increases, the complexity of such a program also
increases. Thus, to make it simpler, C has a multi-way decision statement
known as switch.
a case expression can be repeatedly used in a switch statement. That is, it
allows several alternate courses of actions and choose one to be executed at
runtime.
The use of break statement in every case is used to quit the switch
statement after a particular case is matched. Thus only one case gets executed.
If the break statement is not used, then all the statement following the
matched case will get executed. Thus statement is compulsory for the proper
execution of the switch statement.
8. SYNTEX…
Switch (expression)
{
case value – 1 : // value -1 is a constant and is known as case label.
statement1;
Break; // end of case
case value – 2 // case labels end with a colon(:).
statement1;
break;
default: // optional
default – statement;
break;
}
Statement – x;
9. The break statement is used to jump out of a loop.
An early exit from a loop can be accomplished using the
break statement. When a break statement is encountered inside
a loop, the loop is immediately exited and the program
continues with the statement immediately following the loop.
10. The general forms are:
While (.......)
{
...............
...............
if (condition)
Break;
................
................
}
.....................................
do
{
…………..
…………..
if (condition)
Break;
………………..
……………
} While (……………………)
……………………..
For(…………..)
{
…………….
…………….
if(condition)
break;
……………..
…………………
}
……………………………..
11. Sometimes, in loop iterations, it may be necessary to skip
some statements in that loop and start the next iteration
of that same loop. For such situation, C provides continue
statement.
The continue statement causes the loop to continue with
the next iteration skipping the remaining statement in
that loop.
12. do for (;;)
{ {
……………. ……………….
if ( ) if ( )
continue; continue;
……………… ……………..
….………….. ……………..
} while ( ); }