Decision statements are actually part of a larger category statements known as ??
branches
2 kinds of branch statements?
Conditional branches
Unconditional branches
involves making one or more decisions before branching, and are thus referred to as single-decision or multi-decision branches.
Conditional branches
direct branches which involve no decision. The goto statement is an example of an unconditional branch.
Unconditional branches
The___ statement is a conditional, single-decision branch.
if
The if statement has the general format of ?
if(expression) statement;
IF STATEMENTS may be a ____ statement or ___ statement.
simple
compound
it allows you to check between multiple test expressions and execute different statements.
IF ELSE IF STATEMENTS
a conditional, multi-decision branch. The previous example of successive comparison of equality or value of the operand is so common in programming, a special construct exist in C to handle such comparison.
SWITCH-CASE STATEMENTS
____ is evaluated and its value is compared.
Expression
The expression and the constant compared against must be an _____ constants or expressions. They may NOT contain variables.
integer or character
The default case is optional, but if it exists there can be ____. It may occur anywhere in the list of case clauses but usually occur at the end
only one
One of the fundamental properties of a computer is its ability to repetitively execute a set of statements.
ITERATIVE STATEMENTS
These looping capabilities enable the programmer to develop concise programs containing repetitive processes that could otherwise require thousands of program statements to perform.
ITERATIVE STATEMENTS
C contains three looping constructs:
The while statement
The for statements
The do/while statements
The _____ statements may be described as
test-before-execute. If the controlling condition
results initially to a zero or false value, the body
of the loop is never executed.
while and for
The ____statement on the other hand may be
considered as execute-before-test. The body of the
loop is always executed at least once.
do-while
The _____is used to execute a statement as
long as a condition remains true.
with a syntax of
While (expression){
//statement
}
while loop
The conditional expression, of course, may be
a _____ or ____.
relational or arithmetic
_____ is usually used when the number of times the loop must be executed is not known in advance.
while loop
The ____ is generally used for counted
loops.
for statement
The ______ will execute a statement and then evaluate a conditional expression.
do-while loop
The statements____ and ___ are used to
interrupt the normal flow of loops and the switch
statement.
break AND continue
The ____ is similar to the break statement, except it does not cause the loop to terminate. Rather it causes the loop to be continued.
continue statement
The ____ causes the flow of the program
to branch to the statement immediately following
the appropriate label.
goto statement
A _____is a name that is formed with the same rules in identifiers and must be immediately followed by a colon.
label
The _____ interrupts the normal sequential flow of a program, without involving a decision.
goto statement
Since goto statement is an example of _____ it is difficult to use without the help of conditional branch statements.
unconditional branch
We can properly use goto statements by using some of the _____to avoid infinite looping execution.