Sunday, April 26, 2009

Decision Control Structure

In the previous blogs we have learnt about the different basic requirement to write a C program, now as we move forward we will learn about the different techniques of to write a C program. In this blog we will learn about the decision control structure of C program. Here we will learn about what is decision control structures and decision control algorithms.

Depending on the condition or circumstances we all need to alter our steps, or in simple words we need to take some decisions. Now let us understand the topic with an example form ones day to day life incident.

Let the season is rainy, and a school going could not deicide it today that whether he would be able to go to school on the next day or not. Based no the seasonal condition, if its not raining during the school start time then he would be able to go to school properly, else he have arrange for some other alternative to reach school, and if not possible to arrange for some other alternative then he has be absent in the school on the next.
So, in the above example the work to be done is completely conditional based. In C language the same thing is applicable, sometimes the work which has to be done is fully conditional based, i.e., the designer has to design a program in such a way that it can serve different purposes depending on the conditions applicable.
In C language, there are three major decision making instructions, they are as follows:
  1. The if statement
  2. The if-else statement
  3. The switch statement (The conditional operator)

In the next blogs we will discuss in details about these decision making instructions and solve different exercise related to the decision instructions.

No comments:

Post a Comment

Please give your valuable comments or queries if you fell its helpful or if you like the contents of the site. Thanks...