SlideShare a Scribd company logo
OPERATORS IN C
WHAT IS OPERATOR?
• C support rich set of built-in operators.
• We have already used several of them, such as + - * & = < etc.
• Operators are used in programs to manipulate data and variables.
• An operator is a symbol that perform certain mathematical or logical
manipulations.
• C operators can be classified into number of categories.
TYPES OF OPERATORS
• Arithmetic operators
• Relational operators
• Logical operators
• Assigment operators
• Increment and decrement operators
• Conditional operators
• Bitwise operators
• Special operators
ARITHMETIC OPERATORS
• C provides all the basic arithmetic operators.
• Arithmetic operators are
addition(+),Subtraction(),Multiplication(*),Division(/) and Modulo
division(%).
• For example :
a +b a-b
a*b a/b
• There are 3 types of arithmetic operator
1.Integer arithmetic(When both operands are single
arithmetic expression) ex: 5 + 5 = 10.
2.Real arithmetic(An arithmetic operation involving
only real operands ) ex : 6.0/7.0=0.857143
3.Mixed-mode arithmetic(When one of the
operands is real and the other is integer) ex: 15/10.0 = 1.5
RELATIONAL OPERATORS
• Relational operator compares two quantities depending on their
relation.
• For example : compare the age of two persons,prices of two items
and so on.
• Relational operator : Greater than(>), Greater than or equal to(>=),
Less than(<), Less than or equal to(<=), Equal to(==),Not equal to(!=).
Eg: 10 < 20
a ==b
LOGICAL OPERATORS
• Logical operator which combines two or more relational
expressions,is termed as compound logical expression.
• C has the following three logical operator.
&& - Logical AND
|| - Logical OR
! - Logical NOT
For example : if(age>55 && salary<1000)
ASSIGNMENT OPERATORS
• Assignment operators are used to assign the result of an expression
to a variable.
= -> Assignment operator
Example : a=5;
• C has a set of ‘Shorthand’ assignment operator.
v op=exp
Example : x += 3;
INCREMENT AND DECREMENT OPERATORS
• The increment operator ++ adds 1 to the operand, while the
decrement operator - - subtracts 1 to the operand.
++ - Increment operator
-- - Decrement operator
• We use the increment and decrement statements in for and while
loops.
++m; or m++;
--m; or m--;
CONDITIONAL OPERATORS
• A ternary operator pair “?:” is available in c, the conditional expression of
the form
exp1 ? exp2 : exp3
• Where exp1,exp2,exp3 are expressions.
• exp 1 is evaluated first, if it is true then exp 2 is executed.
• If exp 1 is evaluated , it is false then exp3 is executed.
a=10;
b=15;
x=(a>b)?a : b;
• It can be achieved using if…else statements.
BITWISE OPERATORS
• C has a distinction of supporting special operators known as bitwise
operator for manipulating of data at bit level.
• These operator are used for testing the bits or shifting them right or
left.
& - bitwise AND
| - bitwise OR
<<- shift left
>>-shift right
SPECIAL OPERATORS
• C supports some special operators such as comma operator , sizeof
operator.
• Comma operator : The comma operator used to link the related
expression together.
For example : for(n=1,m=10,n<=m;n++,m++);
• Sizeof operator : Sizeof operator is a compile time operator, it
returns the number of bytes the operand occupies.
For example : m=sizeof(sum);
Ad

More Related Content

Similar to OPERATORS IN C.pptx (20)

Unit-2_chap-4.pptx you from the heart of the
Unit-2_chap-4.pptx you from the heart of theUnit-2_chap-4.pptx you from the heart of the
Unit-2_chap-4.pptx you from the heart of the
MohammedAnas871930
 
operators.pptx
operators.pptxoperators.pptx
operators.pptx
ruchisuru20001
 
Module2.1_Programming_Branching_and_looping.pdf
Module2.1_Programming_Branching_and_looping.pdfModule2.1_Programming_Branching_and_looping.pdf
Module2.1_Programming_Branching_and_looping.pdf
MaheshKini3
 
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
ranaashutosh531pvt
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
ANANT VYAS
 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzation
Kaushal Patel
 
IOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialIOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorial
Hassan A-j
 
Csc240 -lecture_5
Csc240  -lecture_5Csc240  -lecture_5
Csc240 -lecture_5
Ainuddin Yousufzai
 
C language operators
C language operatorsC language operators
C language operators
marar hina
 
Operator in C language
Operator in C languageOperator in C language
Operator in C language
KanhaiyaSharma52
 
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
FarshidKhan
 
Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5
FabMinds
 
operators and expressions in c++
 operators and expressions in c++ operators and expressions in c++
operators and expressions in c++
sanya6900
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
Neeru Mittal
 
Operator in programming in C engineering
Operator in programming in C engineeringOperator in programming in C engineering
Operator in programming in C engineering
roysimran2007
 
Simran Roy Operator in Programming in C Language
Simran Roy Operator in Programming in C LanguageSimran Roy Operator in Programming in C Language
Simran Roy Operator in Programming in C Language
simranroy370
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
Online
 
Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
Thesis Scientist Private Limited
 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
rricky98
 
C++
C++ C++
C++
umardanjumamaiwada
 
Unit-2_chap-4.pptx you from the heart of the
Unit-2_chap-4.pptx you from the heart of theUnit-2_chap-4.pptx you from the heart of the
Unit-2_chap-4.pptx you from the heart of the
MohammedAnas871930
 
Module2.1_Programming_Branching_and_looping.pdf
Module2.1_Programming_Branching_and_looping.pdfModule2.1_Programming_Branching_and_looping.pdf
Module2.1_Programming_Branching_and_looping.pdf
MaheshKini3
 
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
ranaashutosh531pvt
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
ANANT VYAS
 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzation
Kaushal Patel
 
IOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialIOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorial
Hassan A-j
 
C language operators
C language operatorsC language operators
C language operators
marar hina
 
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
FarshidKhan
 
Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5
FabMinds
 
operators and expressions in c++
 operators and expressions in c++ operators and expressions in c++
operators and expressions in c++
sanya6900
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
Neeru Mittal
 
Operator in programming in C engineering
Operator in programming in C engineeringOperator in programming in C engineering
Operator in programming in C engineering
roysimran2007
 
Simran Roy Operator in Programming in C Language
Simran Roy Operator in Programming in C LanguageSimran Roy Operator in Programming in C Language
Simran Roy Operator in Programming in C Language
simranroy370
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
Online
 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
rricky98
 

Recently uploaded (20)

Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Ad

OPERATORS IN C.pptx

  • 2. WHAT IS OPERATOR? • C support rich set of built-in operators. • We have already used several of them, such as + - * & = < etc. • Operators are used in programs to manipulate data and variables. • An operator is a symbol that perform certain mathematical or logical manipulations. • C operators can be classified into number of categories.
  • 3. TYPES OF OPERATORS • Arithmetic operators • Relational operators • Logical operators • Assigment operators • Increment and decrement operators • Conditional operators • Bitwise operators • Special operators
  • 4. ARITHMETIC OPERATORS • C provides all the basic arithmetic operators. • Arithmetic operators are addition(+),Subtraction(),Multiplication(*),Division(/) and Modulo division(%). • For example : a +b a-b a*b a/b
  • 5. • There are 3 types of arithmetic operator 1.Integer arithmetic(When both operands are single arithmetic expression) ex: 5 + 5 = 10. 2.Real arithmetic(An arithmetic operation involving only real operands ) ex : 6.0/7.0=0.857143 3.Mixed-mode arithmetic(When one of the operands is real and the other is integer) ex: 15/10.0 = 1.5
  • 6. RELATIONAL OPERATORS • Relational operator compares two quantities depending on their relation. • For example : compare the age of two persons,prices of two items and so on. • Relational operator : Greater than(>), Greater than or equal to(>=), Less than(<), Less than or equal to(<=), Equal to(==),Not equal to(!=). Eg: 10 < 20 a ==b
  • 7. LOGICAL OPERATORS • Logical operator which combines two or more relational expressions,is termed as compound logical expression. • C has the following three logical operator. && - Logical AND || - Logical OR ! - Logical NOT For example : if(age>55 && salary<1000)
  • 8. ASSIGNMENT OPERATORS • Assignment operators are used to assign the result of an expression to a variable. = -> Assignment operator Example : a=5; • C has a set of ‘Shorthand’ assignment operator. v op=exp Example : x += 3;
  • 9. INCREMENT AND DECREMENT OPERATORS • The increment operator ++ adds 1 to the operand, while the decrement operator - - subtracts 1 to the operand. ++ - Increment operator -- - Decrement operator • We use the increment and decrement statements in for and while loops. ++m; or m++; --m; or m--;
  • 10. CONDITIONAL OPERATORS • A ternary operator pair “?:” is available in c, the conditional expression of the form exp1 ? exp2 : exp3 • Where exp1,exp2,exp3 are expressions. • exp 1 is evaluated first, if it is true then exp 2 is executed. • If exp 1 is evaluated , it is false then exp3 is executed. a=10; b=15; x=(a>b)?a : b; • It can be achieved using if…else statements.
  • 11. BITWISE OPERATORS • C has a distinction of supporting special operators known as bitwise operator for manipulating of data at bit level. • These operator are used for testing the bits or shifting them right or left. & - bitwise AND | - bitwise OR <<- shift left >>-shift right
  • 12. SPECIAL OPERATORS • C supports some special operators such as comma operator , sizeof operator. • Comma operator : The comma operator used to link the related expression together. For example : for(n=1,m=10,n<=m;n++,m++); • Sizeof operator : Sizeof operator is a compile time operator, it returns the number of bytes the operand occupies. For example : m=sizeof(sum);
  翻译: