SlideShare a Scribd company logo
1 of 12
Outline
© Copyright 1992–2004 by Deitel & Associates, Inc. and
1
PATNA UNIVERSITY
PATNA COLLEGE PATNA
CC2 PRESENTATION
Operators
2
BY GROUP NO -03
GOOD MORNNG TO ALL OF YOU
MY TOPIC IS OPERATOR IN ‘C’
Contents
◦ Arithmetic operators
◦ Relational operators
◦ Logical operators
◦ Assignment operators
◦ Increment and decrement operators
◦ Conditional operators
◦ Special operators
3
Introduction
 An operator is a symbol that tells the computer to
perform certain manipulations.
 C operators can be classified into a number of
categories.
◦ Arithmetic operators
◦ Relational operators
◦ Logical operators
◦ Assignment operators
◦ Increment and decrement operators
◦ Conditional operators
◦ Special operators
4
Arithmetic operators
 The arithmetic operators in C
Operator meaning
+ Addition or unary plus
- Subtraction or unary minus
* Multiplication
/ Division
% modulo division
5
Relational Operators
Operator Meaning
< less that
<= less than or equal to
> greater than
>= greater than or equal to
== equal to
!= not equal to
6
• The relational operators in C are :
Logical operators
 C has the following three logical operators
 && meaning logical and
 || meaning logical or
 ! meaning logical not ( unary operator )
7
Assignment operators
 The use of assignment operators has three advantages:
 1. What appears on the left-hand side need not be
repeated and therefore it becomes easier to write.
 2. The statement is more concise and easier to read.
 3. The statement is more efficient.
8
Increment and decrement
operators
 C provides two unusual operators for incrementing
and decrementing variables.
 The increment operator ++ adds 1 to its operand,
while the decrement operator -- subtracts 1.
 The unusual aspect is that ++ and -- may be used
either as prefix operators (before the variable, as in
++n), or postfix operators (after the variable: n++).
 In both cases, the effect is to increment n. But the
expression ++n increments n before its value is used,
while n++ increments n after its value has been used.
9
Conditional operator
 a ternary operator pair “? : ” is available in C to
construct conditional expressions of the form
expr1 ? expr2 : expr3
 the expression expr1 is evaluated first. If it is non-zero
(true), then the expression expr2 is evaluated, and that
is the value of the conditional expression. Otherwise
expr3 is evaluated, and that is the value. Only one of
expr2 and expr3 is evaluated.
10
Special operators
 1. The Comma Operator
 The comma operator can be used to link the related
expressions together. A comma-linked list of
expressions is evaluated left to right and the value of
right-most expression is the value of the combined
expression.
11
 THANKS
12

More Related Content

Similar to Operator in C language

Basic c operators
Basic c operatorsBasic c operators
Basic c operators
dishti7
 
Chapter 3 dti2143
Chapter 3 dti2143Chapter 3 dti2143
Chapter 3 dti2143
alish sha
 
Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Chapter 5 - Operators in C++
Chapter 5 - Operators in C++
Deepak Singh
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressions
vinay arora
 

Similar to Operator in C language (20)

Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
 
Operators and Expressions
Operators and ExpressionsOperators and Expressions
Operators and Expressions
 
Operators and it's type
Operators and it's type Operators and it's type
Operators and it's type
 
C operator and expression
C operator and expressionC operator and expression
C operator and expression
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptx
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptx
 
This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptx
 
Basic c operators
Basic c operatorsBasic c operators
Basic c operators
 
Ch4 Expressions
Ch4 ExpressionsCh4 Expressions
Ch4 Expressions
 
Coper in C
Coper in CCoper in C
Coper in C
 
Cse lecture-4.1-c operators and expression
Cse lecture-4.1-c operators and expressionCse lecture-4.1-c operators and expression
Cse lecture-4.1-c operators and expression
 
Chapter 3 dti2143
Chapter 3 dti2143Chapter 3 dti2143
Chapter 3 dti2143
 
C basics
C basicsC basics
C basics
 
C basics
C basicsC basics
C basics
 
Opreator In "C"
Opreator In "C"Opreator In "C"
Opreator In "C"
 
Unit ii chapter 1 operator and expressions in c
Unit ii chapter 1 operator and expressions in cUnit ii chapter 1 operator and expressions in c
Unit ii chapter 1 operator and expressions in c
 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
 
Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Chapter 5 - Operators in C++
Chapter 5 - Operators in C++
 
Constructor and destructors
Constructor and destructorsConstructor and destructors
Constructor and destructors
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressions
 

Recently uploaded

Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
Overkill Security
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 

Operator in C language

  • 1. Outline © Copyright 1992–2004 by Deitel & Associates, Inc. and 1 PATNA UNIVERSITY PATNA COLLEGE PATNA
  • 2. CC2 PRESENTATION Operators 2 BY GROUP NO -03 GOOD MORNNG TO ALL OF YOU MY TOPIC IS OPERATOR IN ‘C’
  • 3. Contents ◦ Arithmetic operators ◦ Relational operators ◦ Logical operators ◦ Assignment operators ◦ Increment and decrement operators ◦ Conditional operators ◦ Special operators 3
  • 4. Introduction  An operator is a symbol that tells the computer to perform certain manipulations.  C operators can be classified into a number of categories. ◦ Arithmetic operators ◦ Relational operators ◦ Logical operators ◦ Assignment operators ◦ Increment and decrement operators ◦ Conditional operators ◦ Special operators 4
  • 5. Arithmetic operators  The arithmetic operators in C Operator meaning + Addition or unary plus - Subtraction or unary minus * Multiplication / Division % modulo division 5
  • 6. Relational Operators Operator Meaning < less that <= less than or equal to > greater than >= greater than or equal to == equal to != not equal to 6 • The relational operators in C are :
  • 7. Logical operators  C has the following three logical operators  && meaning logical and  || meaning logical or  ! meaning logical not ( unary operator ) 7
  • 8. Assignment operators  The use of assignment operators has three advantages:  1. What appears on the left-hand side need not be repeated and therefore it becomes easier to write.  2. The statement is more concise and easier to read.  3. The statement is more efficient. 8
  • 9. Increment and decrement operators  C provides two unusual operators for incrementing and decrementing variables.  The increment operator ++ adds 1 to its operand, while the decrement operator -- subtracts 1.  The unusual aspect is that ++ and -- may be used either as prefix operators (before the variable, as in ++n), or postfix operators (after the variable: n++).  In both cases, the effect is to increment n. But the expression ++n increments n before its value is used, while n++ increments n after its value has been used. 9
  • 10. Conditional operator  a ternary operator pair “? : ” is available in C to construct conditional expressions of the form expr1 ? expr2 : expr3  the expression expr1 is evaluated first. If it is non-zero (true), then the expression expr2 is evaluated, and that is the value of the conditional expression. Otherwise expr3 is evaluated, and that is the value. Only one of expr2 and expr3 is evaluated. 10
  • 11. Special operators  1. The Comma Operator  The comma operator can be used to link the related expressions together. A comma-linked list of expressions is evaluated left to right and the value of right-most expression is the value of the combined expression. 11