SlideShare a Scribd company logo
1 of 16
C OPERATORS, EXPRESSIONS &
STATEMENTS
C OPERATORS & EXPRESSIONS
• Operators are symbols which take one or
more operands or expressions and perform arithmetic or logical
computations.
• Operands are variables or expressions which are used in conjunction
with operators to evaluate the expression.​
• Combination of operands and operators form an expression.
• Expressions are sequences of operators, operands, and punctuators that
specify a computation.
ARITHMETIC OPERATORS
• As the name is given, arithmetic operators perform arithmetic
operations.
• These are “Binary Operators” as they take two operands.
• C language provides following arithmetic operators.
EXAMPLE
void main()
{
float a=4,b=2,sum,sub,mul,div;
sum=a+b;
sub=a-b;
mul=a*b;
div=a/b;
printf(“summation of a and b=%fn , subtraction of and b=%fn ,
multiplication of and b=%fn, division of a and b=%f, sum, sub, mul, div”);
}
RESULT
CONDITIONAL OPEARTORS
• C language provides “?” operator as a conditional operator.
• These are “Ternary Operators” as they take three operands.
• It is used as shown below:
Syntax: Condition ? Expression1 : Expression2
• The statement above is equivalent to:
if (Condition)
Expression1
else
Expression2
CONDITIONAL OPEARTORS
• The operator “?” works as follows:
1. Expression1 is evaluated first.
2. If it is non-zero(true), then the expression1 is evaluated and becomes
the value of the expression.
3. If expression1 is false, expression2 is evaluated and its value
becomes the value of the expression.
4. It is to be noted that only one of the expression(either expression1 or
expression2) is evaluated.
RELATIONAL OPERATORS
• Also known as a comparison operator, it is an operator that compares
two values.
• Relational operators return true or false value, depending on whether
the conditional relationship between the two operands holds or not.
EQUALITY OPERATORS
• C language supports two kinds of equality operators to compare their
operands for strict equality or inequality.
• They are equal to (==) and not equal to (!=) operator.
• The equality operators have lower precedence than the relational
operators.
LOGICAL OPERATORS
• C language supports three logical operators.
• They are- Logical AND (&&), Logical OR (||) and Logical NOT (!).
• As in case of arithmetic expressions, the logical expressions are
evaluated from left to right.
ASSIGNMENT OPERATORS
• The assignment operator is responsible for assigning values to the variables.
• While the equal sign (=) is the fundamental assignment operator, C also supports
other assignment operators that provide short hand ways to represent common
variable assignments
BITWISE OPERATORS
• Bitwise operators perform operations at bit level. These operators include :
bitwise AND, bitwiseOR, bitwise XOR and shift operators.
• The bitwise AND operator (&) is a small version of the boolean AND (&&)
as it performs operation on bits instead of bytes, chars, integers, etc.
• The bitwise OR operator (|) is a small version of the boolean OR (||) as it
performs operation on bits instead of bytes, chars, integers, etc.
• The bitwise NOT (~), or complement, is a unary operation that performs
logical negation on each bit of the operand. By performing negation of each
bit, it actually produces the ones‘ complement of the given binary value.
• The bitwise XOR operator (^) performs operation on individual bits of the
operands.
BITWISE OPERATORS
BITWISE SHIFT OPERATORS
• In bitwise shift operations, the digits are moved, or shifted, to the left or right.
• The CPU registers have a fixed number of available bits for storing numerals, so
when we perform shift operations; some bits will be "shifted out" of the register at
one end, while the same number of bits are "shifted in" from the other end.
UNARY OPERATOR
• Unary operators act on single operands.
• C language supports three unary operators. They are unary minus, increment and
decrement operators.
• The increment operator is a unary operator that increases the value of its operand
by 1.
• Similarly, the decrement operator decreases the value of its operand by 1. For
example,
• int x = 10, y;
• y = x++; is equivalent to writing y = x; x = x + 1;
• whereas, y = ++x; is equivalent to writing x = x + 1; y = x;
COMMA OPERATOR
• The comma operator in C takes two operands. It works by evaluating the
first and discarding its value, and then evaluates the second and returns the
value as the result of the expression.
• Comma separated operands when chained together are evaluated in left-to-
right sequence with the right-most value yielding the result of the
expression.
• Among all the operators, the comma operator has the lowest precedence.
For example,
int a=2, b=3, x=0;
x = (++a, b+=a);
Now, the value of x = 6
SIZEOF OPERATOR
• sizeof is a unary operator used to calculate the sizes of data types.
• It can be applied to all data types.
• The operator returns the size of the variable, data type or expression in bytes.
• 'sizeof' operator is used to determine the amount of memory space that the
variable/expression/data type will take.
• For example, sizeof(char) returns 1, that is the size of a character data type. If we
have,
int a = 10;
unsigned int result;
result = sizeof(a);
then result = 2,

More Related Content

What's hot

Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoderAbid Ali
 
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)ISMT College
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of CAshim Lamichhane
 
Logic System Design KTU Chapter-4.ppt
Logic System Design KTU Chapter-4.pptLogic System Design KTU Chapter-4.ppt
Logic System Design KTU Chapter-4.pptAlbin562191
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programmingManoj Tyagi
 
Signed Binary Numbers
Signed Binary NumbersSigned Binary Numbers
Signed Binary Numberspyingkodi maran
 
Operators in C++
Operators in C++Operators in C++
Operators in C++Sachin Sharma
 
Operators in C
Operators in COperators in C
Operators in CSimplilearn
 
Top down and botttom up Parsing
Top down     and botttom up ParsingTop down     and botttom up Parsing
Top down and botttom up ParsingGerwin Ocsena
 
Introduction to digital logic
Introduction to digital logicIntroduction to digital logic
Introduction to digital logicKamal Acharya
 
De lab manual
De lab manualDe lab manual
De lab manualNaga Rajan
 
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 cSowmya Jyothi
 
Operator Precedence Grammar
Operator Precedence GrammarOperator Precedence Grammar
Operator Precedence GrammarHarisonFekadu
 
Difference between combinational and
Difference between combinational andDifference between combinational and
Difference between combinational andDamodar Panigrahy
 

What's hot (20)

Logic gate
Logic gateLogic gate
Logic gate
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
 
Operators
OperatorsOperators
Operators
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
 
Logic System Design KTU Chapter-4.ppt
Logic System Design KTU Chapter-4.pptLogic System Design KTU Chapter-4.ppt
Logic System Design KTU Chapter-4.ppt
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
 
Operator.ppt
Operator.pptOperator.ppt
Operator.ppt
 
Signed Binary Numbers
Signed Binary NumbersSigned Binary Numbers
Signed Binary Numbers
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 
Operators in C
Operators in COperators in C
Operators in C
 
Operators in C & C++ Language
Operators in C & C++ LanguageOperators in C & C++ Language
Operators in C & C++ Language
 
Top down and botttom up Parsing
Top down     and botttom up ParsingTop down     and botttom up Parsing
Top down and botttom up Parsing
 
Introduction to digital logic
Introduction to digital logicIntroduction to digital logic
Introduction to digital logic
 
Operators in java
Operators in javaOperators in java
Operators in java
 
De lab manual
De lab manualDe lab manual
De lab manual
 
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
 
Operator Precedence Grammar
Operator Precedence GrammarOperator Precedence Grammar
Operator Precedence Grammar
 
Difference between combinational and
Difference between combinational andDifference between combinational and
Difference between combinational and
 

Similar to OPERATORS IN C.pptx

OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++ANANT VYAS
 
L3 operators
L3 operatorsL3 operators
L3 operatorsteach4uin
 
L3 operators
L3 operatorsL3 operators
L3 operatorsteach4uin
 
L3 operators
L3 operatorsL3 operators
L3 operatorsteach4uin
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptxPonmeenakshi1
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptxAshokJ19
 
4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.pptRithwikRanjan
 
C sharp part 001
C sharp part 001C sharp part 001
C sharp part 001Ralph Weber
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageDr.Florence Dayana
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++Online
 
operators in c++
operators in c++operators in c++
operators in c++Kartik Fulara
 
operators in c++
operators in c++operators in c++
operators in c++Kartik Fulara
 
Operators and Expressions
Operators and ExpressionsOperators and Expressions
Operators and ExpressionsMunazza-Mah-Jabeen
 
Operators and Expressions in C++
Operators and Expressions in C++Operators and Expressions in C++
Operators and Expressions in C++Praveen M Jigajinni
 
IOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialIOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialHassan A-j
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 

Similar to OPERATORS IN C.pptx (20)

OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
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
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt
 
C sharp part 001
C sharp part 001C sharp part 001
C sharp part 001
 
Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
 
operators in c++
operators in c++operators in c++
operators in c++
 
operators in c++
operators in c++operators in c++
operators in c++
 
Operators and Expressions
Operators and ExpressionsOperators and Expressions
Operators and Expressions
 
Operators and Expressions in C++
Operators and Expressions in C++Operators and Expressions in C++
Operators and Expressions in C++
 
Coper in C
Coper in CCoper in C
Coper in C
 
IOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialIOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorial
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 

More from LECO9

C Programming Intro.ppt
C Programming Intro.pptC Programming Intro.ppt
C Programming Intro.pptLECO9
 
Embedded Systems.pptx
Embedded Systems.pptxEmbedded Systems.pptx
Embedded Systems.pptxLECO9
 
Basic Electronics.pptx
Basic Electronics.pptxBasic Electronics.pptx
Basic Electronics.pptxLECO9
 
Intro to Microcontroller.pptx
Intro to Microcontroller.pptxIntro to Microcontroller.pptx
Intro to Microcontroller.pptxLECO9
 
PIC_Intro.pptx
PIC_Intro.pptxPIC_Intro.pptx
PIC_Intro.pptxLECO9
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxLECO9
 
UNIONS IN C.pptx
UNIONS IN C.pptxUNIONS IN C.pptx
UNIONS IN C.pptxLECO9
 
Processes, Threads.pptx
Processes, Threads.pptxProcesses, Threads.pptx
Processes, Threads.pptxLECO9
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxLECO9
 
FUNCTIONS IN C.pptx
FUNCTIONS IN C.pptxFUNCTIONS IN C.pptx
FUNCTIONS IN C.pptxLECO9
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptxLECO9
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxLECO9
 
cprogramming Structures.pptx
cprogramming Structures.pptxcprogramming Structures.pptx
cprogramming Structures.pptxLECO9
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptxLECO9
 
DYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxDYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxLECO9
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptxLECO9
 
cprogramming strings.pptx
cprogramming strings.pptxcprogramming strings.pptx
cprogramming strings.pptxLECO9
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptxLECO9
 
C-Programming Function pointers.pptx
C-Programming  Function pointers.pptxC-Programming  Function pointers.pptx
C-Programming Function pointers.pptxLECO9
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptxLECO9
 

More from LECO9 (20)

C Programming Intro.ppt
C Programming Intro.pptC Programming Intro.ppt
C Programming Intro.ppt
 
Embedded Systems.pptx
Embedded Systems.pptxEmbedded Systems.pptx
Embedded Systems.pptx
 
Basic Electronics.pptx
Basic Electronics.pptxBasic Electronics.pptx
Basic Electronics.pptx
 
Intro to Microcontroller.pptx
Intro to Microcontroller.pptxIntro to Microcontroller.pptx
Intro to Microcontroller.pptx
 
PIC_Intro.pptx
PIC_Intro.pptxPIC_Intro.pptx
PIC_Intro.pptx
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
UNIONS IN C.pptx
UNIONS IN C.pptxUNIONS IN C.pptx
UNIONS IN C.pptx
 
Processes, Threads.pptx
Processes, Threads.pptxProcesses, Threads.pptx
Processes, Threads.pptx
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
 
FUNCTIONS IN C.pptx
FUNCTIONS IN C.pptxFUNCTIONS IN C.pptx
FUNCTIONS IN C.pptx
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptx
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
cprogramming Structures.pptx
cprogramming Structures.pptxcprogramming Structures.pptx
cprogramming Structures.pptx
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptx
 
DYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxDYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptx
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
 
cprogramming strings.pptx
cprogramming strings.pptxcprogramming strings.pptx
cprogramming strings.pptx
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
 
C-Programming Function pointers.pptx
C-Programming  Function pointers.pptxC-Programming  Function pointers.pptx
C-Programming Function pointers.pptx
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptx
 

Recently uploaded

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
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
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 

Recently uploaded (20)

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
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
 
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
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
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...
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 

OPERATORS IN C.pptx

  • 2. C OPERATORS & EXPRESSIONS • Operators are symbols which take one or more operands or expressions and perform arithmetic or logical computations. • Operands are variables or expressions which are used in conjunction with operators to evaluate the expression.​ • Combination of operands and operators form an expression. • Expressions are sequences of operators, operands, and punctuators that specify a computation.
  • 3. ARITHMETIC OPERATORS • As the name is given, arithmetic operators perform arithmetic operations. • These are “Binary Operators” as they take two operands. • C language provides following arithmetic operators.
  • 4. EXAMPLE void main() { float a=4,b=2,sum,sub,mul,div; sum=a+b; sub=a-b; mul=a*b; div=a/b; printf(“summation of a and b=%fn , subtraction of and b=%fn , multiplication of and b=%fn, division of a and b=%f, sum, sub, mul, div”); } RESULT
  • 5. CONDITIONAL OPEARTORS • C language provides “?” operator as a conditional operator. • These are “Ternary Operators” as they take three operands. • It is used as shown below: Syntax: Condition ? Expression1 : Expression2 • The statement above is equivalent to: if (Condition) Expression1 else Expression2
  • 6. CONDITIONAL OPEARTORS • The operator “?” works as follows: 1. Expression1 is evaluated first. 2. If it is non-zero(true), then the expression1 is evaluated and becomes the value of the expression. 3. If expression1 is false, expression2 is evaluated and its value becomes the value of the expression. 4. It is to be noted that only one of the expression(either expression1 or expression2) is evaluated.
  • 7. RELATIONAL OPERATORS • Also known as a comparison operator, it is an operator that compares two values. • Relational operators return true or false value, depending on whether the conditional relationship between the two operands holds or not.
  • 8. EQUALITY OPERATORS • C language supports two kinds of equality operators to compare their operands for strict equality or inequality. • They are equal to (==) and not equal to (!=) operator. • The equality operators have lower precedence than the relational operators.
  • 9. LOGICAL OPERATORS • C language supports three logical operators. • They are- Logical AND (&&), Logical OR (||) and Logical NOT (!). • As in case of arithmetic expressions, the logical expressions are evaluated from left to right.
  • 10. ASSIGNMENT OPERATORS • The assignment operator is responsible for assigning values to the variables. • While the equal sign (=) is the fundamental assignment operator, C also supports other assignment operators that provide short hand ways to represent common variable assignments
  • 11. BITWISE OPERATORS • Bitwise operators perform operations at bit level. These operators include : bitwise AND, bitwiseOR, bitwise XOR and shift operators. • The bitwise AND operator (&) is a small version of the boolean AND (&&) as it performs operation on bits instead of bytes, chars, integers, etc. • The bitwise OR operator (|) is a small version of the boolean OR (||) as it performs operation on bits instead of bytes, chars, integers, etc. • The bitwise NOT (~), or complement, is a unary operation that performs logical negation on each bit of the operand. By performing negation of each bit, it actually produces the ones‘ complement of the given binary value. • The bitwise XOR operator (^) performs operation on individual bits of the operands.
  • 13. BITWISE SHIFT OPERATORS • In bitwise shift operations, the digits are moved, or shifted, to the left or right. • The CPU registers have a fixed number of available bits for storing numerals, so when we perform shift operations; some bits will be "shifted out" of the register at one end, while the same number of bits are "shifted in" from the other end.
  • 14. UNARY OPERATOR • Unary operators act on single operands. • C language supports three unary operators. They are unary minus, increment and decrement operators. • The increment operator is a unary operator that increases the value of its operand by 1. • Similarly, the decrement operator decreases the value of its operand by 1. For example, • int x = 10, y; • y = x++; is equivalent to writing y = x; x = x + 1; • whereas, y = ++x; is equivalent to writing x = x + 1; y = x;
  • 15. COMMA OPERATOR • The comma operator in C takes two operands. It works by evaluating the first and discarding its value, and then evaluates the second and returns the value as the result of the expression. • Comma separated operands when chained together are evaluated in left-to- right sequence with the right-most value yielding the result of the expression. • Among all the operators, the comma operator has the lowest precedence. For example, int a=2, b=3, x=0; x = (++a, b+=a); Now, the value of x = 6
  • 16. SIZEOF OPERATOR • sizeof is a unary operator used to calculate the sizes of data types. • It can be applied to all data types. • The operator returns the size of the variable, data type or expression in bytes. • 'sizeof' operator is used to determine the amount of memory space that the variable/expression/data type will take. • For example, sizeof(char) returns 1, that is the size of a character data type. If we have, int a = 10; unsigned int result; result = sizeof(a); then result = 2,