Programming For Problem Solving
Unit ll: “Operators in Programming”
Operators in Programming
Operators in Programming
An operator in C can be defined as the symbol that helps us to perform some
specific mathematical, relational, bitwise, conditional, or logical computations
on values and variables. The values and variables used with operators are
called operands. So, we can say that the operators are the symbols that
perform operations on operands.
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
Types of Operators in C
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Bitwise Operators
5. Assignment
Operators
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
1. Arithmetic
Operators
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
Logical Operators are used
to combine two or more
conditions/constraints or to
complement the evaluation
of the original condition in
consideration. The result of
the operation of a logical
operator is a Boolean value
either true or false.
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
The Bitwise operators are used to
perform bit-level operations on the
operands. The operators are first
converted to bit-level and then the
calculation is performed on the
operands. Mathematical operations
such as addition, subtraction,
multiplication, etc. can be
performed at the bit level for faster
processing.
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
Assignment Operators in C
• Assignment operators are used to assign value
to a variable. The left side operand of the
assignment operator is a variable and the right
side operand of the assignment operator is a
value. The value on the right side must be of the
same data type as the variable on the left side
otherwise the compiler will raise an error.
• The assignment operators can be combined with
some other operators in C to provide multiple
operations using single operator. These
operators are called compound operators.
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
•Any Question?
Assist Professor. Varinder Singh (Dept. Engineering)
Operators in Programming
•THANK YOU
Assist Professor. Varinder Singh (Dept. Engineering)