SlideShare a Scribd company logo
What is an Operator?
Operator is a symbol that indicates the compiler to perform some
specific mathematical or logical function. There are a variety of
operators in C language.
sum = a + b;
Operand
Operator
There are variety of operators in C Language :-
1- Arithmetic Operator
2- Increment Decrement Operator
3- Assignment Operator
4- Relational Operator
5- Logical Operator
6- Bitwise Operator
7- Special Operator or Miscellaneous Operator
Arithmetic Operator
This operator is used to perform mathematical operations such as multiplication,
division, addition, subtraction on the numerical values.
Operator Operation Example
+
-
*
/
%
Addition of operands
Subtraction of operands
Multiplication of operands
Division of operands
It return remainder
3 + 2 = 5
3 - 2 = 1
3 * 2 = 6
6 / 2 = 3
10 % 2 = 0
Increment decrement Operator
There are two operations in C programming ++ and – called as Increment and
decrement operators, it used to increase the cause by one and decrease the
value by one.
Operator Operation Example(a=10)
++
--
Increments the value by one
Decrements the value by one
a++ //11
a-- //9
Assignment Operator
This operator is used to assign the value to the variable, = is most common of all
the assignment operator.
Operator Example Same as
=
+=
*=
/=
%=
a=5 a = 5
a = a+5
a = a*5
a = a/5
a = a% 5
a+=5
a*=5
a/=5
a%=5
Relational Operator
It is used to check the relation between the two operands, if the relation is true
it returns 1 if the relation is false it returns 0.
Operator Meaning of Operator Example
==
!=
>
<
>=
Check if two operand are equal 5==5 //1
5>3 //1
5<3 //0
5>=5 //1
if two operand are not equal
if operand on the left is greater than operand on the right
operand on the left is smaller than right operand
if operand on left is smaller than or equal to right operand
5!=2 //1
Logical Operator
The expression containing this logical operator returns 0 or 1 depending upon
result is true or false. It is generally used with decision making.
Operator Meaning of Operator Example (a=2, b=5)
||
!
Returns true if all are true ((a==2) && (b==5)) //True
Returns true if any one is true
Returns true when value is false
&&
((a==2) || (b>7)) //True
!(a==2) //False
Bitwise Operator
When we use this operator the mathematical or computation operation we are
doing is converted to bit level first to make the processing faster and saves
power.
a
0
0
1
1
b
1
0
1
0
a & b
0
0
1
0
a | b
1
0
1
1
a ^ b
1
0
0
1
Bitwise Operator
Left shift
a = 00010000
b=2
a<<b
01000000
Right shift
a = 00010000
b=2
a>>b
00000100
Special Operators
Operator Meaning of Operator Example (a=2, b=5)
&
*
Returns size of variable Int a; sizeof(a) //2
Returns address of the variable
Points to address of another variable
sizeof()
Int a; &a //address
int *ptr
, Used as separator and operator both a=(3,5,4) //4
Comma Operator
int a=10, b=20, c=50; //separator
int a = (5,10,18); //operator
Output  18
Because comma operator takes the rightmost value, it
evaluates all values but rejects them.
int a = 5,10,18 ; //error
int a = 5, int 10, int 18 ; //error
Let’s see Special Operators in Turbo C

More Related Content

PPTX
Python operators
PPTX
Operators in C & C++ Language
PPT
2. operators in c
PDF
Coper in C
ODP
Operators
PPTX
C Operators
PPTX
Operators and it's type
Python operators
Operators in C & C++ Language
2. operators in c
Coper in C
Operators
C Operators
Operators and it's type

What's hot (19)

PPT
Arithmetic operator
PPTX
Operators in C/C++
PPTX
Oop using JAVA
PPTX
Python Programming | JNTUK | UNIT 1 | Lecture 5
PPT
Basic c operators
PPT
CBSE Class XI :- Operators in C++
PPTX
Operators in c++
PPT
Operation and expression in c++
PDF
Operators in c
PPTX
PPT
2 1 expressions
PPTX
Operator
PPTX
PPTX
Mathematical and logical operators
PPTX
Operators and expressions
PPTX
Opreator In "C"
PPT
C Prog. - Operators and Expressions
PPTX
Matlab operators
PPTX
Operators and expressions in C++
Arithmetic operator
Operators in C/C++
Oop using JAVA
Python Programming | JNTUK | UNIT 1 | Lecture 5
Basic c operators
CBSE Class XI :- Operators in C++
Operators in c++
Operation and expression in c++
Operators in c
2 1 expressions
Operator
Mathematical and logical operators
Operators and expressions
Opreator In "C"
C Prog. - Operators and Expressions
Matlab operators
Operators and expressions in C++
Ad

Similar to What are operators? (20)

PPTX
Operator of C language
PDF
C++ revision tour
PDF
C++ revision tour
PDF
C++ Expressions Notes
PPTX
lecture4 pgdca.pptx
PPT
operator ppt.ppt
PPTX
ComputerProgrammingVarialblesanddeclaration.pptx
PPT
Operators
DOCX
PPS 2.2.OPERATORS ARITHMETIC EXPRESSIONS/ARITHMETIC OPERATORS/RELATIONAL OPER...
PPT
C Sharp Jn (2)
PPT
C Sharp Jn (2)
PPT
Operator & Expression in c++
PPTX
Operators and Expressions
PPTX
Operators-computer programming and utilzation
PPTX
Operator in JAVA
PDF
Chapter 5 - Operators in C++
PPTX
IOS Swift Language 3rd tutorial
DOCX
Basics of c++
PPTX
Cse lecture-4.1-c operators and expression
PDF
Lecture 3 programming fundaments by abdul rauf.pdf
Operator of C language
C++ revision tour
C++ revision tour
C++ Expressions Notes
lecture4 pgdca.pptx
operator ppt.ppt
ComputerProgrammingVarialblesanddeclaration.pptx
Operators
PPS 2.2.OPERATORS ARITHMETIC EXPRESSIONS/ARITHMETIC OPERATORS/RELATIONAL OPER...
C Sharp Jn (2)
C Sharp Jn (2)
Operator & Expression in c++
Operators and Expressions
Operators-computer programming and utilzation
Operator in JAVA
Chapter 5 - Operators in C++
IOS Swift Language 3rd tutorial
Basics of c++
Cse lecture-4.1-c operators and expression
Lecture 3 programming fundaments by abdul rauf.pdf
Ad

More from AnuragSrivastava272 (13)

PPTX
What is recursion?
PPTX
What is Do while loop?
PPTX
What is while loop?
PPTX
What is loops? What is For loop?
PPTX
What is Switch Case?
PPTX
What are conditional statements?
PPTX
What is Non-primitive data type?
PPTX
What is Data Types and Functions?
PPTX
What is Variables and Header files
PPTX
What is IDE?
PPTX
What is Platform Dependency?
PPTX
What is Computer Language?
PPTX
What is Language?
What is recursion?
What is Do while loop?
What is while loop?
What is loops? What is For loop?
What is Switch Case?
What are conditional statements?
What is Non-primitive data type?
What is Data Types and Functions?
What is Variables and Header files
What is IDE?
What is Platform Dependency?
What is Computer Language?
What is Language?

Recently uploaded (20)

PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Trump Administration's workforce development strategy
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
master seminar digital applications in india
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Final Presentation General Medicine 03-08-2024.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Module 4: Burden of Disease Tutorial Slides S2 2025
Orientation - ARALprogram of Deped to the Parents.pptx
Trump Administration's workforce development strategy
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Microbial diseases, their pathogenesis and prophylaxis
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Microbial disease of the cardiovascular and lymphatic systems
Practical Manual AGRO-233 Principles and Practices of Natural Farming
2.FourierTransform-ShortQuestionswithAnswers.pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Paper A Mock Exam 9_ Attempt review.pdf.
master seminar digital applications in india
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
A systematic review of self-coping strategies used by university students to ...
Final Presentation General Medicine 03-08-2024.pptx

What are operators?

  • 1. What is an Operator?
  • 2. Operator is a symbol that indicates the compiler to perform some specific mathematical or logical function. There are a variety of operators in C language. sum = a + b; Operand Operator
  • 3. There are variety of operators in C Language :- 1- Arithmetic Operator 2- Increment Decrement Operator 3- Assignment Operator 4- Relational Operator 5- Logical Operator 6- Bitwise Operator 7- Special Operator or Miscellaneous Operator
  • 4. Arithmetic Operator This operator is used to perform mathematical operations such as multiplication, division, addition, subtraction on the numerical values. Operator Operation Example + - * / % Addition of operands Subtraction of operands Multiplication of operands Division of operands It return remainder 3 + 2 = 5 3 - 2 = 1 3 * 2 = 6 6 / 2 = 3 10 % 2 = 0
  • 5. Increment decrement Operator There are two operations in C programming ++ and – called as Increment and decrement operators, it used to increase the cause by one and decrease the value by one. Operator Operation Example(a=10) ++ -- Increments the value by one Decrements the value by one a++ //11 a-- //9
  • 6. Assignment Operator This operator is used to assign the value to the variable, = is most common of all the assignment operator. Operator Example Same as = += *= /= %= a=5 a = 5 a = a+5 a = a*5 a = a/5 a = a% 5 a+=5 a*=5 a/=5 a%=5
  • 7. Relational Operator It is used to check the relation between the two operands, if the relation is true it returns 1 if the relation is false it returns 0. Operator Meaning of Operator Example == != > < >= Check if two operand are equal 5==5 //1 5>3 //1 5<3 //0 5>=5 //1 if two operand are not equal if operand on the left is greater than operand on the right operand on the left is smaller than right operand if operand on left is smaller than or equal to right operand 5!=2 //1
  • 8. Logical Operator The expression containing this logical operator returns 0 or 1 depending upon result is true or false. It is generally used with decision making. Operator Meaning of Operator Example (a=2, b=5) || ! Returns true if all are true ((a==2) && (b==5)) //True Returns true if any one is true Returns true when value is false && ((a==2) || (b>7)) //True !(a==2) //False
  • 9. Bitwise Operator When we use this operator the mathematical or computation operation we are doing is converted to bit level first to make the processing faster and saves power. a 0 0 1 1 b 1 0 1 0 a & b 0 0 1 0 a | b 1 0 1 1 a ^ b 1 0 0 1
  • 10. Bitwise Operator Left shift a = 00010000 b=2 a<<b 01000000 Right shift a = 00010000 b=2 a>>b 00000100
  • 11. Special Operators Operator Meaning of Operator Example (a=2, b=5) & * Returns size of variable Int a; sizeof(a) //2 Returns address of the variable Points to address of another variable sizeof() Int a; &a //address int *ptr , Used as separator and operator both a=(3,5,4) //4
  • 12. Comma Operator int a=10, b=20, c=50; //separator int a = (5,10,18); //operator Output  18 Because comma operator takes the rightmost value, it evaluates all values but rejects them. int a = 5,10,18 ; //error int a = 5, int 10, int 18 ; //error
  • 13. Let’s see Special Operators in Turbo C