Chap 2 : Unit 2 : If Control Structure : part 1

Decision in programming is inherent of any language like in our life. The same is explained here and syntax of if control structure is here for you…

First is the if control structure. In C Language if is the  keyword enlightened 

Condition needs to be written in a pair of round brackets following the keyword if

This if condition is then followed by pair of curly braces…

All statements you write inside pair of curly braces are associated with if condition and it is called if block.enlightened

Now let’s see how condition is tested…

In C Language… condition can be tested using Relation operators provided by Dennis Ritchie

Can you recall how many operators we used in the last chapter….? Plus…(+) Minus (-)…Multiplication (*)…Division (/) …आणि Modulus… (%)..

All these were Mathematical operators 

and we used Assignment operator as well….

unknowingly what you used special charcaters like comma, semi colon were also operators…

Now in this chapter we will see six more operators.

These are <, >, <=, >=, ==, != all these operators are called as Relation operators to establish relation between operands….   

in C Language when we write condition using Relation operator we check whether conditional expresion is true or false

if it is True, Expression returns 1 or on the contrary if expression returns non zero value the condition becomes true.

likewise if expression false then value of the expression is zero and same is returned where as if value of the expressoin is zero then expression is false.

Where ever you use conditional expressions, don’t forget this important concept

And do remember that you will not put semi colon at the end of semi colon…. nonetheless a few exceptions are there too…!smiley

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. Register for Discount Coupon


Leave a Reply

%d bloggers like this: