SlideShare a Scribd company logo
Pt. Mohan Lal SD College For Women
Gurdaspur
TOPIC : C Operators
Created by: Mrs. Rajni
Asst. Prof. in Computer Science
What is an operator
 An operator is a symbol that tells the computer to
perform certain mathematical or logical
manipulations.
 These operators are used in programs to manipulate
data and variables
C Operators
1. Arithmetic operators
2. Relational Operators
3. Logical Operators
4. Assignment Operators
5. Increments and Decrement Operators
6. Conditional Operators
7. Bitwise Operators
8. Special Operators
Arithmetic operators
Operator Meaning
+ Addition or Unary Plus
– Subtraction or Unary Minus
* Multiplication
/ Division
% Modulus Operator
Integer Arithmetic
Let x = 27 and y = 5
z = x + y 32
z = x – y 22
z = x * y 115
z = x % y 2
z = x / y 5
Floating point arithmetic
Let x = 14.0 and y = 4.0
then z = x + y 18.0
z = x – y 10.0
z = x * y 56.0
z = x / y 3.50
Relational Operators
Operator Meaning
< is less than
<= is less than or equal to
> is greater than
>= is greater than or equal to
== is equal to
!= is not equal to
Relational Expressions
6.5 <= 25 TRUE
-65 > 0 FALSE 10
< 7 + 5 TRUE
Logical Operators
Operator Meaning
&& Logical AND
|| Logical OR
! Logical NOT
Find out the answer
a > b && x = = 10
a < m || a < n
! (x >= y)
a = 5
b = 4
x=10, y = 9
m=6
n = 3
Assignment Operators
Statement with simple Statement with
assignment operator shorthand operator
a = a + 1 a += 1
a = a – 1 a -= 1
a = a * (n+1) a *= (n+1)
a = a / (n+1) a /= (n+1)
a = a % b a %= b
Increment and Decrement
OperatorsTwo most useful operators which are present in 'c' are
increment and decrement operators. Operators: ++ and
–-
The operator ++ adds one to the operand
The operator -- subtracts one from the operand.
Both are unary operators and can be used as pre or post
increment/decrement
CONDITIONAL OPERATORS
 These conditional operator are used to construct
conditional expressions of the form.
Syntax: exp1?exp2:exp3.
where exp1,exp2,exp3 are expressions.
Operator: ?: (ternary operator)
BITWISE OPERATORS
 These operators works on bit level
 Applied to Integers only
OPERATOR MEANING
& Bitwise AND
| Bitwise OR
^ Bitwise Exclusive OR
<< Shift Left
>> Shift Right
SPECIAL OPERATORS
 C' supports some special operators such as comma
operator, sizeof operator and pointer operators.
 Comma operator: the comma operator is used to
combine related expressions. A comma linked list of
expressions are evaluated left to right and the value of
right most expression is the value of combined
expression.. Example: value=(x=10, y=5, x+y)
SPECIAL OPERATORS
 Sizeof Operator
Sizeof is an operator used to return the number of bytes
the operand occupies. Syntax:
m=sizeof(sum);
k=sizeof(2351);
Thanks

More Related Content

PPTX
Operators and Expressions
PPTX
Python operators
PPT
PPTX
Python Training in Bangalore | Python Operators | Learnbay.in
PPTX
Python Operators
PDF
C++ Expressions Notes
PDF
SPL 6 | Operators in C
PPT
Fundamentals of Programming Chapter 5
Operators and Expressions
Python operators
Python Training in Bangalore | Python Operators | Learnbay.in
Python Operators
C++ Expressions Notes
SPL 6 | Operators in C
Fundamentals of Programming Chapter 5

What's hot (19)

PPT
operator
PPTX
Opeartor &amp; expression
PDF
PDF
Chap 5 c++
PPTX
PPTX
Error analysis
PDF
Difcalc10week2
PDF
Chap 4 c++
PPT
C Sharp Jn (2)
PPTX
PPTX
Matlab Files
PDF
DiffCalcFirstPartialReview
PPTX
Basics of c programming cit r.sandhiya
PDF
Difcalc10week3
PPTX
Python operators part2
PDF
Functions lect
PPTX
python operators.pptx
PPTX
Assignment problem
operator
Opeartor &amp; expression
Chap 5 c++
Error analysis
Difcalc10week2
Chap 4 c++
C Sharp Jn (2)
Matlab Files
DiffCalcFirstPartialReview
Basics of c programming cit r.sandhiya
Difcalc10week3
Python operators part2
Functions lect
python operators.pptx
Assignment problem
Ad

Similar to C operators ppt (20)

PPTX
operators.pptx
PPTX
PPTX
OPERATORS OF C++
PPTX
OPERATORS IN C.pptx
PPTX
OPERATORS IN C.pptx
PPT
C Operators in programming langues .ppt
PDF
Unit ii chapter 1 operator and expressions in c
PPT
Operators in c language
PPTX
3. C_OperatorsExpressions on c languyage.pptx
PPTX
C language operator
PPTX
Operators-computer programming and utilzation
PPTX
Cse lecture-4.1-c operators and expression
PDF
Coper in C
PPTX
C Operators
PPT
Operators in C Programming
PDF
C Operators and Control Structures.pdf
PPT
Types of operators in C
PPTX
C Operators and Control Structures.pptx
PPTX
Simran Roy Operator in Programming in C Language
PPTX
Operator in programming in C engineering
operators.pptx
OPERATORS OF C++
OPERATORS IN C.pptx
OPERATORS IN C.pptx
C Operators in programming langues .ppt
Unit ii chapter 1 operator and expressions in c
Operators in c language
3. C_OperatorsExpressions on c languyage.pptx
C language operator
Operators-computer programming and utilzation
Cse lecture-4.1-c operators and expression
Coper in C
C Operators
Operators in C Programming
C Operators and Control Structures.pdf
Types of operators in C
C Operators and Control Structures.pptx
Simran Roy Operator in Programming in C Language
Operator in programming in C engineering
Ad

More from RajniKashyap9 (7)

PPTX
Mail merge
PPTX
Introduction to structured query language (sql) (1)
PPTX
Computer software
PPTX
Operating systems11 9-07
PPT
C language
PPT
Basic computer organization
PPT
Internet
Mail merge
Introduction to structured query language (sql) (1)
Computer software
Operating systems11 9-07
C language
Basic computer organization
Internet

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
composite construction of structures.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Current and future trends in Computer Vision.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Well-logging-methods_new................
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPT
introduction to datamining and warehousing
PDF
PPT on Performance Review to get promotions
PDF
Digital Logic Computer Design lecture notes
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
Project quality management in manufacturing
PPT
Mechanical Engineering MATERIALS Selection
R24 SURVEYING LAB MANUAL for civil enggi
composite construction of structures.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Current and future trends in Computer Vision.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
OOP with Java - Java Introduction (Basics)
Well-logging-methods_new................
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Lecture Notes Electrical Wiring System Components
Operating System & Kernel Study Guide-1 - converted.pdf
introduction to datamining and warehousing
PPT on Performance Review to get promotions
Digital Logic Computer Design lecture notes
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Project quality management in manufacturing
Mechanical Engineering MATERIALS Selection

C operators ppt

  • 1. Pt. Mohan Lal SD College For Women Gurdaspur TOPIC : C Operators Created by: Mrs. Rajni Asst. Prof. in Computer Science
  • 2. What is an operator  An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations.  These operators are used in programs to manipulate data and variables
  • 3. C Operators 1. Arithmetic operators 2. Relational Operators 3. Logical Operators 4. Assignment Operators 5. Increments and Decrement Operators 6. Conditional Operators 7. Bitwise Operators 8. Special Operators
  • 4. Arithmetic operators Operator Meaning + Addition or Unary Plus – Subtraction or Unary Minus * Multiplication / Division % Modulus Operator
  • 5. Integer Arithmetic Let x = 27 and y = 5 z = x + y 32 z = x – y 22 z = x * y 115 z = x % y 2 z = x / y 5
  • 6. Floating point arithmetic Let x = 14.0 and y = 4.0 then z = x + y 18.0 z = x – y 10.0 z = x * y 56.0 z = x / y 3.50
  • 7. Relational Operators Operator Meaning < is less than <= is less than or equal to > is greater than >= is greater than or equal to == is equal to != is not equal to
  • 8. Relational Expressions 6.5 <= 25 TRUE -65 > 0 FALSE 10 < 7 + 5 TRUE
  • 9. Logical Operators Operator Meaning && Logical AND || Logical OR ! Logical NOT
  • 10. Find out the answer a > b && x = = 10 a < m || a < n ! (x >= y) a = 5 b = 4 x=10, y = 9 m=6 n = 3
  • 11. Assignment Operators Statement with simple Statement with assignment operator shorthand operator a = a + 1 a += 1 a = a – 1 a -= 1 a = a * (n+1) a *= (n+1) a = a / (n+1) a /= (n+1) a = a % b a %= b
  • 12. Increment and Decrement OperatorsTwo most useful operators which are present in 'c' are increment and decrement operators. Operators: ++ and –- The operator ++ adds one to the operand The operator -- subtracts one from the operand. Both are unary operators and can be used as pre or post increment/decrement
  • 13. CONDITIONAL OPERATORS  These conditional operator are used to construct conditional expressions of the form. Syntax: exp1?exp2:exp3. where exp1,exp2,exp3 are expressions. Operator: ?: (ternary operator)
  • 14. BITWISE OPERATORS  These operators works on bit level  Applied to Integers only OPERATOR MEANING & Bitwise AND | Bitwise OR ^ Bitwise Exclusive OR << Shift Left >> Shift Right
  • 15. SPECIAL OPERATORS  C' supports some special operators such as comma operator, sizeof operator and pointer operators.  Comma operator: the comma operator is used to combine related expressions. A comma linked list of expressions are evaluated left to right and the value of right most expression is the value of combined expression.. Example: value=(x=10, y=5, x+y)
  • 16. SPECIAL OPERATORS  Sizeof Operator Sizeof is an operator used to return the number of bytes the operand occupies. Syntax: m=sizeof(sum); k=sizeof(2351);