Decision Making Statements
Decision Making Statements
int main() {
int i;
for (i = 1; i <= 15; i++) {
printf("%d\n", i);
if (i == 10)
break;
}
return 0;
}
continue
The continue jump statement like any other
jump statement interrupts or changes the
flow of control during the execution of a
program. Continue is mostly used in loops.
Rather than terminating the loop it stops the
execution of the statements underneath and
takes control to the next iteration.
Similar to a break statement, in the case of a
nested loop, the continue passes the control
to the next iteration of the inner loop where it
is present and not to any of the outer loops.
#include <stdio.h>
int main()
{
int i, j;
for (j = 1; j < 5; j++) {
if (j == 2)
break;
printf("%d\n", j);
}
return 0;
}
goto statements
goto jump statement is used to transfer the
flow of control to any part of the program
desired. The programmer needs to specify a
label or identifier with the goto statement in
the following manner:
goto label;