SlideShare a Scribd company logo
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

PPTX
operators.pptx
PPT
C Operators in programming langues .ppt
PPTX
PPTX
Operators-computer programming and utilzation
PPT
Operators in c language
PPTX
OPERATORS IN C.pptx
PPTX
OPERATORS IN C.pptx
PPT
C operators ppt
operators.pptx
C Operators in programming langues .ppt
Operators-computer programming and utilzation
Operators in c language
OPERATORS IN C.pptx
OPERATORS IN C.pptx
C operators ppt

Similar to Operator in C language (20)

PPT
Operators in C Programming
PPTX
Opreator In "C"
PPTX
3. C_OperatorsExpressions on c languyage.pptx
PPTX
Unit-2_chap-4.pptx you from the heart of the
PPTX
C language operator
PPTX
OPERATORS IN C.pptx
PPTX
OPERATORS IN C.pptx
PPTX
operator (1).pptx
PDF
Types of Operators in C
PPTX
C Operators and Control Structures.pptx
PPTX
presentation of c language. with ternary operator
PPTX
C Operators
PDF
Types of Operators in C programming .pdf
PDF
C Operators and Control Structures.pdf
PPTX
Arithmetic and increment decrement Operator
PDF
Unit ii chapter 1 operator and expressions in c
PPT
Operators in Computer programming presentation
PPTX
Operators and expressions
PPTX
Operators in C programming language.pptx
PPT
Basics of C.ppt this is basic information about the c programming language
Operators in C Programming
Opreator In "C"
3. C_OperatorsExpressions on c languyage.pptx
Unit-2_chap-4.pptx you from the heart of the
C language operator
OPERATORS IN C.pptx
OPERATORS IN C.pptx
operator (1).pptx
Types of Operators in C
C Operators and Control Structures.pptx
presentation of c language. with ternary operator
C Operators
Types of Operators in C programming .pdf
C Operators and Control Structures.pdf
Arithmetic and increment decrement Operator
Unit ii chapter 1 operator and expressions in c
Operators in Computer programming presentation
Operators and expressions
Operators in C programming language.pptx
Basics of C.ppt this is basic information about the c programming language
Ad

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Programs and apps: productivity, graphics, security and other tools
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Understanding_Digital_Forensics_Presentation.pptx
Ad

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