SlideShare une entreprise Scribd logo
1  sur  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,

Contenu connexe

Tendances (6)

Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
Digital Electronics - Counters
Digital Electronics - CountersDigital Electronics - Counters
Digital Electronics - Counters
 
Catraca Henry Pedestal Inox - Prospecto Especificações
Catraca Henry Pedestal Inox - Prospecto EspecificaçõesCatraca Henry Pedestal Inox - Prospecto Especificações
Catraca Henry Pedestal Inox - Prospecto Especificações
 
08 logic simplification
08 logic simplification08 logic simplification
08 logic simplification
 
ROM (Read Only Memory)
ROM (Read Only Memory)ROM (Read Only Memory)
ROM (Read Only Memory)
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoder
 

Similaire à OPERATORS IN C.pptx

Similaire à OPERATORS IN C.pptx (20)

OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF 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
 
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
 

Plus de 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 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
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxLECO9
 

Plus de 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 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
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
 

Dernier

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 

Dernier (20)

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 

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,