SlideShare una empresa de Scribd logo
1 de 18
1
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.
2
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Assignment operators
5. Increment and decrement operators
6. Conditional operators (ternary operator)
7. Bitwise operators
8. Special operators
3
Arithmetic operators are used to perform numerical calculations
among the values.
OPERATOR MEANING
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo Division
4
#include<stdio.h>
Main()
{
int x=25;
int y=4;
printf(“%d+%d=%dn,x,y,x+y);
printf(“%d-%d=%dn,x,y,x-y);
printf(“%d*%d=%dn,x,y,x*y);
printf(“%d/%d=%dn,x,y,x/y);
printf(“%d%%%d=%dn,x,y,x%y);
5
Relational operator are used to compare two operands.
Operands may be variable, constant or expression.
OperatorOperator MeaningMeaning
< Is less than
<= Is less than equal to
> Is greater than
>= Is greater than equal to
== Equal to
!= is not equal to
6
#include<stdio.h>
void main()
{
int a, b;
printf(“Enter values for a and b : ");
scanf("%d %d", &a, &b);
printf("n The < value of a is %d", a<b);
printf("n The <= value of a is %d", a<=b);
printf("n The > value of a is %d", a>b);
printf("n The >= value of a is %d", a>=b);
printf("n The == value of a is %d", a==b);
printf("n The != value of a is %d", a!=b);
}
7
LOGICAL OPERATORS:
OPERATOR MEANING
&& Logical AND
|| Logical OR
! Logical NOT
These operators are used for testing more than one condition and
making decisions.
'C' has three logical operators they are:
8
Example:-Example:-
#Include<stdio.h>
void main()
{
int a, b;
printf(“enter values for a and b : ");
scanf(“%d %d", &a, &b);
printf("n %d",(a<b)&&(a!=B));
printf("n %d",(a<b)||(b<a));
printf("n %d",!(A==b));
}
9
ASSIGNMENT OPERATORS
Assignment operator are used to assign
the value or an expression or a variable to
another variable.
 The syntax is
variablename = expression;
i.g. A=b;
 Operators:
== , += , -= , *= , /= , %= , >>= , <<= ,
&= ,
10
Increments & decrement operator is also called Unary .
The increment operator (++++) adder on to the variable and
decrement (- -- -) subtract one from the variable. There are
following unary operator
INCREMENT & DECREMENTINCREMENT & DECREMENT
OPERATORSOPERATORS
Operator Meaning
++x++x Pre increment
- -x- -x Pre decrement
x++x++ Post increment
X- -X- - Post decrement
11
INCREMENT & DECREMENT OPERATORSINCREMENT & DECREMENT OPERATORS
EXAMPLEEXAMPLE
#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter the values for a and b :");
scanf("%d %d", &a, &b);
printf("n The value of c is %d", c=++a);
printf("n The value of c is %d", c=a++);
printf("n The value of c is %d", c=--b);
printf("n The value of c is %d", c=b--);
}
12
CONDITIONALCONDITIONAL
OPERATORSOPERATORSThese conditional operator are used to construct
conditional expressions of the form.
Syntax:
exp1?exp2:exp3.
where exp1,exp2,exp3 are expressions.
Operator: ?: (ternary operator)
13
Example:-Example:-
#include<stdio.h>
void main()
{
int a, b, x;
printf("Enter the values of a add b : ");
scanf("%d %d", &a, &b);
x=(a>b)?a:b;
printf("Biggest Value is :%d",x);
}
14
Bitwise Operator:-Bitwise Operator:-
Are used by the programmer to communicate
directly with the hardware.These operator are
used for designing bit or shifting them either
right to left, left to right.
Example:-
OPERATOR MEANING
& Bitwise AND
| Bitwise OR
^ Bitwise Exclusive OR
<< Shift Left
>> Shift Right
15
SPECIAL OPERATORSSPECIAL OPERATORS
'C' supports some special operators such as comma
operator, sizeof operator and pointerpointer operators.
Comma operator: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 OperatorsSpecial Operators
Contd…Contd…
Sizeof Operator:Sizeof Operator:
Sizeof is an operator used to return the
number of bytes the operand occupies.
Syntax:
m=sizeof(sum);
k=sizeof(2351);
17
18

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

C presentation book
C presentation bookC presentation book
C presentation book
 
2. operators in c
2. operators in c2. operators in c
2. operators in c
 
6 operators-in-c
6 operators-in-c6 operators-in-c
6 operators-in-c
 
Unit 3. Input and Output
Unit 3. Input and OutputUnit 3. Input and Output
Unit 3. Input and Output
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C Language
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressions
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 
Types of function call
Types of function callTypes of function call
Types of function call
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Operators in python
Operators in pythonOperators in python
Operators in python
 

Destacado

Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in CPrabhu Govind
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressionsvinay arora
 
Excel Based IP Functions
Excel Based IP FunctionsExcel Based IP Functions
Excel Based IP FunctionsRajiv Bhardwaj
 
Hr development, methods and desig
Hr development, methods and desigHr development, methods and desig
Hr development, methods and desigPrakash Dhakal
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly languagehemant meena
 
mySQL - INSERT INTO
mySQL - INSERT INTOmySQL - INSERT INTO
mySQL - INSERT INTOlehrerfreund
 
Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?Pyxis Technologies
 
Convegno la mela nel mondo interpoma bz - 16-11-2012 1+2 - martin thalheime...
Convegno la mela nel mondo   interpoma bz - 16-11-2012 1+2 - martin thalheime...Convegno la mela nel mondo   interpoma bz - 16-11-2012 1+2 - martin thalheime...
Convegno la mela nel mondo interpoma bz - 16-11-2012 1+2 - martin thalheime...Image Line
 
area econòmica i patrimonial
area econòmica i patrimonialarea econòmica i patrimonial
area econòmica i patrimonialSandro
 
Canvi climàtic: Efectes i percepció social
Canvi climàtic: Efectes i percepció socialCanvi climàtic: Efectes i percepció social
Canvi climàtic: Efectes i percepció socialJosep Lluís Ruiz
 
Le Lean Product Management présenté au LeanKanban Day 2015
Le Lean Product Management présenté au LeanKanban Day 2015Le Lean Product Management présenté au LeanKanban Day 2015
Le Lean Product Management présenté au LeanKanban Day 2015Sébastien Sacard
 
Arquitectura de Computadores (II Bimestre)
Arquitectura de Computadores (II Bimestre)Arquitectura de Computadores (II Bimestre)
Arquitectura de Computadores (II Bimestre)Videoconferencias UTPL
 
Tema 3 Dissolucions 1er batxillerat
Tema 3 Dissolucions 1er batxilleratTema 3 Dissolucions 1er batxillerat
Tema 3 Dissolucions 1er batxilleratmmarti61
 
Les propietats dels materials i els assaigs d'estudi
Les propietats dels materials i els assaigs d'estudiLes propietats dels materials i els assaigs d'estudi
Les propietats dels materials i els assaigs d'estudiGlòria García García
 

Destacado (20)

Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressions
 
C ppt
C pptC ppt
C ppt
 
Excel Based IP Functions
Excel Based IP FunctionsExcel Based IP Functions
Excel Based IP Functions
 
Slides chapter 16
Slides chapter 16Slides chapter 16
Slides chapter 16
 
Elm intro
Elm introElm intro
Elm intro
 
Hr development, methods and desig
Hr development, methods and desigHr development, methods and desig
Hr development, methods and desig
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly language
 
mySQL - INSERT INTO
mySQL - INSERT INTOmySQL - INSERT INTO
mySQL - INSERT INTO
 
Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?
 
Convegno la mela nel mondo interpoma bz - 16-11-2012 1+2 - martin thalheime...
Convegno la mela nel mondo   interpoma bz - 16-11-2012 1+2 - martin thalheime...Convegno la mela nel mondo   interpoma bz - 16-11-2012 1+2 - martin thalheime...
Convegno la mela nel mondo interpoma bz - 16-11-2012 1+2 - martin thalheime...
 
Scrum Guide
Scrum GuideScrum Guide
Scrum Guide
 
Lliço5 Cinèticaquímica
Lliço5 CinèticaquímicaLliço5 Cinèticaquímica
Lliço5 Cinèticaquímica
 
area econòmica i patrimonial
area econòmica i patrimonialarea econòmica i patrimonial
area econòmica i patrimonial
 
Canvi climàtic: Efectes i percepció social
Canvi climàtic: Efectes i percepció socialCanvi climàtic: Efectes i percepció social
Canvi climàtic: Efectes i percepció social
 
Le Lean Product Management présenté au LeanKanban Day 2015
Le Lean Product Management présenté au LeanKanban Day 2015Le Lean Product Management présenté au LeanKanban Day 2015
Le Lean Product Management présenté au LeanKanban Day 2015
 
Arquitectura de Computadores (II Bimestre)
Arquitectura de Computadores (II Bimestre)Arquitectura de Computadores (II Bimestre)
Arquitectura de Computadores (II Bimestre)
 
Tema 3 Dissolucions 1er batxillerat
Tema 3 Dissolucions 1er batxilleratTema 3 Dissolucions 1er batxillerat
Tema 3 Dissolucions 1er batxillerat
 
Les propietats dels materials i els assaigs d'estudi
Les propietats dels materials i els assaigs d'estudiLes propietats dels materials i els assaigs d'estudi
Les propietats dels materials i els assaigs d'estudi
 
Tema15
Tema15Tema15
Tema15
 

Similar a Operators in c language

Types of Operators in C programming .pdf
Types of Operators in C programming  .pdfTypes of Operators in C programming  .pdf
Types of Operators in C programming .pdfRichardMathengeSPASP
 
C language operator
C language operatorC language operator
C language operatorcprogram
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2Don Dooley
 
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTES
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTESUnit 1- PROGRAMMING IN C OPERATORS LECTURER NOTES
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTESLeahRachael
 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzationKaushal Patel
 
OPERATORS.pptx
OPERATORS.pptxOPERATORS.pptx
OPERATORS.pptxPMLAVANYA
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c languageTanmay Modi
 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptxManojKhadilkar1
 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdfMaryJacob24
 
PROGRAMMING IN C - Operators.pptx
PROGRAMMING IN C - Operators.pptxPROGRAMMING IN C - Operators.pptx
PROGRAMMING IN C - Operators.pptxNithya K
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in cSaranya saran
 
Intro to c chapter cover 1 4
Intro to c chapter cover 1 4Intro to c chapter cover 1 4
Intro to c chapter cover 1 4Hazwan Arif
 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsAmrinder Sidhu
 

Similar a Operators in c language (20)

Types of Operators in C programming .pdf
Types of Operators in C programming  .pdfTypes of Operators in C programming  .pdf
Types of Operators in C programming .pdf
 
C language operator
C language operatorC language operator
C language operator
 
2. operator
2. operator2. operator
2. operator
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2
 
Operators1.pptx
Operators1.pptxOperators1.pptx
Operators1.pptx
 
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTES
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTESUnit 1- PROGRAMMING IN C OPERATORS LECTURER NOTES
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTES
 
operators.pptx
operators.pptxoperators.pptx
operators.pptx
 
Theory3
Theory3Theory3
Theory3
 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzation
 
OPERATORS.pptx
OPERATORS.pptxOPERATORS.pptx
OPERATORS.pptx
 
C語言運算式和運算子
C語言運算式和運算子C語言運算式和運算子
C語言運算式和運算子
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptx
 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdf
 
PROGRAMMING IN C - Operators.pptx
PROGRAMMING IN C - Operators.pptxPROGRAMMING IN C - Operators.pptx
PROGRAMMING IN C - Operators.pptx
 
Unit 2
Unit 2Unit 2
Unit 2
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
 
Fucntions & Pointers in C
Fucntions & Pointers in CFucntions & Pointers in C
Fucntions & Pointers in C
 
Intro to c chapter cover 1 4
Intro to c chapter cover 1 4Intro to c chapter cover 1 4
Intro to c chapter cover 1 4
 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operators
 

Último

Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Internet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxInternet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxVelmuruganTECE
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptNarmatha D
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsDILIPKUMARMONDAL6
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadaditya806802
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 

Último (20)

Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Internet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxInternet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptx
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.ppt
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teams
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasad
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 

Operators in c language

  • 1. 1
  • 2. 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. 2
  • 3. 1. Arithmetic operators 2. Relational operators 3. Logical operators 4. Assignment operators 5. Increment and decrement operators 6. Conditional operators (ternary operator) 7. Bitwise operators 8. Special operators 3
  • 4. Arithmetic operators are used to perform numerical calculations among the values. OPERATOR MEANING + Addition - Subtraction * Multiplication / Division % Modulo Division 4
  • 6. Relational operator are used to compare two operands. Operands may be variable, constant or expression. OperatorOperator MeaningMeaning < Is less than <= Is less than equal to > Is greater than >= Is greater than equal to == Equal to != is not equal to 6
  • 7. #include<stdio.h> void main() { int a, b; printf(“Enter values for a and b : "); scanf("%d %d", &a, &b); printf("n The < value of a is %d", a<b); printf("n The <= value of a is %d", a<=b); printf("n The > value of a is %d", a>b); printf("n The >= value of a is %d", a>=b); printf("n The == value of a is %d", a==b); printf("n The != value of a is %d", a!=b); } 7
  • 8. LOGICAL OPERATORS: OPERATOR MEANING && Logical AND || Logical OR ! Logical NOT These operators are used for testing more than one condition and making decisions. 'C' has three logical operators they are: 8
  • 9. Example:-Example:- #Include<stdio.h> void main() { int a, b; printf(“enter values for a and b : "); scanf(“%d %d", &a, &b); printf("n %d",(a<b)&&(a!=B)); printf("n %d",(a<b)||(b<a)); printf("n %d",!(A==b)); } 9
  • 10. ASSIGNMENT OPERATORS Assignment operator are used to assign the value or an expression or a variable to another variable.  The syntax is variablename = expression; i.g. A=b;  Operators: == , += , -= , *= , /= , %= , >>= , <<= , &= , 10
  • 11. Increments & decrement operator is also called Unary . The increment operator (++++) adder on to the variable and decrement (- -- -) subtract one from the variable. There are following unary operator INCREMENT & DECREMENTINCREMENT & DECREMENT OPERATORSOPERATORS Operator Meaning ++x++x Pre increment - -x- -x Pre decrement x++x++ Post increment X- -X- - Post decrement 11
  • 12. INCREMENT & DECREMENT OPERATORSINCREMENT & DECREMENT OPERATORS EXAMPLEEXAMPLE #include<stdio.h> void main() { int a,b,c; printf("Enter the values for a and b :"); scanf("%d %d", &a, &b); printf("n The value of c is %d", c=++a); printf("n The value of c is %d", c=a++); printf("n The value of c is %d", c=--b); printf("n The value of c is %d", c=b--); } 12
  • 13. CONDITIONALCONDITIONAL OPERATORSOPERATORSThese conditional operator are used to construct conditional expressions of the form. Syntax: exp1?exp2:exp3. where exp1,exp2,exp3 are expressions. Operator: ?: (ternary operator) 13
  • 14. Example:-Example:- #include<stdio.h> void main() { int a, b, x; printf("Enter the values of a add b : "); scanf("%d %d", &a, &b); x=(a>b)?a:b; printf("Biggest Value is :%d",x); } 14
  • 15. Bitwise Operator:-Bitwise Operator:- Are used by the programmer to communicate directly with the hardware.These operator are used for designing bit or shifting them either right to left, left to right. Example:- OPERATOR MEANING & Bitwise AND | Bitwise OR ^ Bitwise Exclusive OR << Shift Left >> Shift Right 15
  • 16. SPECIAL OPERATORSSPECIAL OPERATORS 'C' supports some special operators such as comma operator, sizeof operator and pointerpointer operators. Comma operator: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
  • 17. Special OperatorsSpecial Operators Contd…Contd… Sizeof Operator:Sizeof Operator: Sizeof is an operator used to return the number of bytes the operand occupies. Syntax: m=sizeof(sum); k=sizeof(2351); 17
  • 18. 18