C Decision Making - Branching

Contents


A C Program is a set of statements which are normally executed sequentially in the order in which they appear. In practice, we have a number of situations where we may have to change the order of execution of statements based on certain conditions, or repeat a group of statements until certain specified condition are met.
This involves a kind of decision making to see whether a particular condition has occurred or not and then direct the computer to execute certain statements accordingly.
C language possesses such decision-making capabilities by supporting the following statements.
  • If statement
  • Switch Statement
  • Conditional Operator Statement
  • Goto statement
This statement are known as decision-making statements and control statement.
  • Branching
  • if Statement
  • The If else construct
  • Compound Relational tests
  • Nested if Statement
  • The ELSE If Ladder
  • The Switch Statement
  • The GOTO statement

Branching

The C language programs presented until now follows a sequential form of execution of statements.
Many times it is required to alter the flow of the sequence of instructions.
C language provides statements that can alter the flow of a sequence of instructions.
These statements are called control statements.
These statements help to jump from one part of the program to another.
The control transfer may be conditional or unconditional.

Make Comments..!!


Oops!! No posts from user.

Download Android App