explain operators in c programming | Allinonetuts

Operators in C Programming

Relational Operators:

Relational operators are used to comparing the value of two variable for various conditions such as greater, less than or equal etc. All relational operator returns the result in either ‘True’ or ‘False’.
Following are some widely used relational operator in C Programming.

  •     < less than
  •     < = less than to equal to
  •     > greater than
  •     > = greater than or equal to
  •     = = equal to
  •     ! = not equal to

Below is the example showing result of some relational expressions.

12! = 15 True
12== = 12 True
46 > = 47 False
2.88 < = 3.10 True

Click here to see all Operators in C Programming with Expressions

Logical Operators:

An expression, which combines two or more relational expression, is called logical expression. Just similar to the relational expression, logical expression results in either true or false.
Following are the logical operators used in the C program.






    Logical AND Operator   



Logical OR Operator



Logical NOT Operator

The relational operators are self-explanatory. As far as the explanation of the logical operators is concerned, consider the following.

Any operator which uses two characters as a symbol should have no space between the two characters, that is = = is erroneous, if it is written as = =

The Logical AND Operator:

1.    Evaluates true, when both the relational expression are true.

2.    Evaluates false, when any one of the relational expression is false.

Conditional Operator:

The C language has an unusual operator, useful for making two-way decisions. Is this operator a combination of? and: takes three operands. The general form of use of conditional operator is as follows:

Conditional expression? expression 1: expression 2

The conditional expression is evaluated first. If the result is nonzero, expression 1 is evaluated and is returned as the value of the conditional expression. Otherwise, expression 2 is evaluated and its value is returned.

For Example:

if (x < 0) flag = 0;
flag= 1;
can be written as
flag = (x < 0) ? 0 : 1;
Hello Viewers,
welcome to the Allinonetuts a Technical tutorial and Programming Blog Maintained by Vikas Kardam, a Web Developer and Blogger From Delhi, India.
Explain Operators in C Programming was last modified: June 30th, 2017 by Vikas Kardam
Submit your review

Create your own review

Average rating:  
 1 reviews

Nice article for learning C Programming

Leave a Reply

Your email address will not be published. Required fields are marked *