Decision making and branching
We have seen that a C program is a set of statements which are normally executed sequentially in the order in which they appear. This happens when no options are available. During programming, we have a number of situations where we may have to change the execution of statements on certain conditions, or repeat a group of statements until certain specified conditions are met. This involves a kind of decision making to see whether a particular condition has occured or not and then direct the computer to execute certain statements accordingly.
C language supports the following statements to possesses such decision making capabilities.
i) if statement
ii) switch statement
iii) Conditional operator statement
iv) goto statement
These statements helps in decision making, so these are called as decision making statements. Also these statements controls the flow of execution ,so they are also known as control statements.
C language supports the following statements to possesses such decision making capabilities.
i) if statement
ii) switch statement
iii) Conditional operator statement
iv) goto statement
These statements helps in decision making, so these are called as decision making statements. Also these statements controls the flow of execution ,so they are also known as control statements.
Comments
Post a Comment