You are on page 1of 12

NAME: Pradeep.

D
ROLL NO: 19BCA031
BCA’A’
C Assignment
Class presentation
OPERATORS
WHAT ARE OPERATORS
An operator is a symbol that operates on a
value or a variable.
Ex: a+b
Where a,b is operands
+ is an operator
Types of Operator
1. Logical operators
2. Relational operators
3. Arthematic operators
4. Bitwise operatirs
5. Incremental or decremental operators
6. Shift operators
Etc
Arthematic Operators
Arithmetic operators are used to perform
mathematical calculations like addition,
subtraction, multiplication, division and
modulus in C programs.
There are 5 Arthematic operators
+,-,*,/,%.
Assignment Operators
In C programs, values for the variables are
assigned using assignment operators.
For example, if the value “10” is to be
assigned for the variable “sum”, it can be
assigned as “sum = 10;”
There are 2 categories of assignment
operators in C language. They are,
1. Simple assignment operator ( Example: = )
2. Compound assignment operators (
Example: +=, -=, *=, /=, %=, &=, ^= )
Relational operators
Relational operators are used to find the
relation between two variables. i.e. to compare
the values of two variables in a C program.
There are 6 different operators
<,>,!=,==,<=,>=
Logical operators
These operators are used to perform logical
operations on the given expressions.
There are 3 logical operators in C language.
They are, logical AND (&&), logical OR (||)
and logical NOT (!).
Bitwise Operator
These operators are used to perform bit
operations. Decimal values are converted into
binary values which are the sequence of bits and
bit wise operators work on these bits.
Bit wise operators in C language are & (bitwise
AND), | (bitwise OR), ~ (bitwise NOT), ^ (XOR),
<< (left shift) and >> (right shift).
Increment operators are used to increase the
value of the variable by one and decrement
operators are used to decrease the value of
the variable by one in C programs.
Syntax:
Increment operator: ++var_name; (or) var_name++;
Decrement operator: – -var_name; (or) var_name – -;
Example:
Increment operator : ++ i ; i ++ ;
Decrement operator : – – i ; i – – ;
THE END

You might also like