You are on page 1of 6

G H Raisoni Institute of Engineering

and Technology

Presentation on C Operators
By Gayatri Bagade
Third sem , Electrical

1
Operators
 An operator is a symbol or letter used to indicate a specific operation
on variables in a program. Example, the symbol `+' is an add operator
that adds two data items called operands.
 Expression. An expression is a combination of operands (i.e.,
constants, variables, numbers) connected by operators and
parentheses. Example, in the expression given below, A and B are
operands and `+' is an operator.
A+B
 An expression that involves arithmetic operators is known as an
arithmetic expression.
 The computed result of an arithmetic expression is always a numerical
value.
 An expression which involves relational and/or logical operators is
called a Boolean expression or logical expression.
 The computed result of such an expression is a logical value, i.e., either
1 (True) or 0 (False).
Computer Fundamentals and Programming in C 2
Arithmetic Operators
Arithmetic operators can further be classified as unary
operators and binary operators.
Arithmetic operators

Computer Fundamentals and Programming in C 3


Relational and Logical Operators
A relational operator is used to compare two values
and the result of such an operation is always logical,
i.e., either true or false.
The valid relational operators supported by C are
given below:
Symbol Stands for Example

>  Greater than X>Y


>= Greater than equal to X >= Y
<  Less than X<Y
<= Less than equal to X <= Y
== Equal to X == Y
!= Not equal to X != Y

Computer Fundamentals and Programming in C 4


Logical Operators
A logical operator is used to connect two relational
expressions or logical expressions.
The result of such an operation is always logical, i.e.,
either True (1) or False (0). The valid logical operators
supported by C are given below:
Symbol Stands for Example

&& Logical AND x && y


|| Logical OR x || y
! Logical NOT !x

Computer Fundamentals and Programming in C 5


Rules of Logical Operators
1. The output of a logical AND operation is true if both
its operands are true. For all other combinations, the
result is false.
2. The output of a logical OR operation is false if both
of its operands are false. For all other combinations
the result is true.
3. The logical NOT is a unary operator. It negates the
value of the operand.

Computer Fundamentals and Programming in C 6

You might also like