CONTROL STRUCTURE:-
Hanging if is not allowed in C language.
If a statement is used for checking range and yes/no problem.
else is the optional part of the if.
Execution of the switch case starts from the match case.
Use break to prevent the falling of control from one case to another case.
If none of the cases are satisfied then default case will be satisfied.
Case character only can be an integral constant.
Switch case only checks integral does not check the float.
Continue cannot be part of the switch case.
Switch without case no use ( no output no error).
The duplicate case is not allowed in C.
Switch case is the replacement of if…else statement
Switch case is used for the selection control statement
Loop counter can be int, char, and float
If loop counter is not initialized in a loop, that is called odd loop
Loop is an alternate of function recursion and function recursion is an alternate of the loop.
for loop is suitable for finite loop, while loop is suitable for unknown loop and do-while loop is suitable for at least once
loop counter has its own block scoping
Drop all the parts of for loop is an infinite loop but drops all part of while and do-while loop is an error
break in loop transfer control outside the loop
continue to transfer the control to the beginning of the loop
If the loop counter exceeds its range, it will be an infinite loop
Every loop has start value, step value and stops value
If the loop loses its step value, it will be an infinite loop
Repeating some parts of program and Software delay use loop
A loop is faster than function recursion.
Loop Control Structure:-
For
For(initialize counter; test condition; re-evaluation parameter)
{
Statement;
Statement;
}
While
while(test condition)
{
Body of loop
}
Do-while
do
{
statement;
}
while(condition)
Selection Control Structure:-
Switch case
Switch(variable)
{
Case constant A;
Statement;
Break;
Case constant B;
Statement;
Break;
Default;
Statement;
}
Default
Decision Control Structure:-
If:-
if(condition)
Statement;
If Else
If (condition)
{
Statement 1;
Statement 2;
}
else
{
Statement 3;
Statement 4;
}
Break statement
Break;
Continue statement;
Continue;
Default;
Jump Control Structure:-
Go to
goto label;