SlideShare a Scribd company logo
WELCOME
Name: Panchal Dhrumil Indravadan
Activity: CPU (ALA)
Branch: Computer Engineering(B.E.)
Semester: Second SEM
Year: 2017-18
Topic
Type conversion, Precedence
and Associativity
Contains
 Type conversion
 Implicit type casting
 Explicit type casting
 Precedence
 Associativity
Type Conversion
 When an operator has operands of different
types, they are converted to a common type, this
known as type casting or type conversion.
 Typecasting is making a variable of one data type
to act like another data type such as an int to
float.
Implicit Type Casting
 C automatically converts any intermediates
values to the proper type so that the expression
can be evaluated without losing any significance.
 This automatic conversion is known as implicit
type conversion.
 The lower type is automatically converted to the
higher type before the operation proceeds. The
result is higher type.
 Example:
 If one operands is int and other is float then int
will be converted to float.
 If one operands is float and other is long double
then float will be converted to long double.
 Thus conversion happens from low data type to
high data type so that information is not lost. The
conversion hierarchy is shown next slide.
Explicit Type Casting
 Sometimes we want to force a type conversion in
a way that is different from automatic conversion.
The process of such a local conversion or casting
is known as explicit casting.
 The general form of cast is: (type-name)
expression.
 Where type-name is one of the standard C data
type. The expression may be constant, variable,
or an expression.
Example
 #include<stdio.h>
 int main()
 {
 int sum=47, n=10;
 float avg;
 avg=sum / n;
 printf(“Result of Implicit Type Casting: %f”, avg);
 avg=(float)sum / (float)n;
 printf(“Result of Explicit Type Casting: %f”, avg);
 return 0;
 }
Output
 Result of Implicit Type Casting: 4.000000
 Result of Explicit Type Casting: 4.700000
Precedence
 Precedence of an operator is its priority in an
expression for evaluation.
 Operator precedence is why the expression 5 + 3
* 2 is calculated as 5 + (3 * 2), giving 11, and not
as (5 + 3) * 2, giving 16.
 We say that the multiplication operator (*) has
higher "precedence" or "priority" than the
addition operator (+), so the multiplication must
be performed first.
Following table provides a complete list of operator, their
precedence level, and their rule of association. Rank 1 indicates
highest precedence level and 15 is the lowest.
Associativity
 Associativity is the left-to-right or right-to-left
order for grouping operands to operators that
have the same precedence.
 Operator associativity is why the expression 8 - 3 -
2 is calculated as (8 - 3) - 2, giving 3, and not as 8 -
(3 - 2), giving 7.
 We say that the subtraction operator (-) is "left
associative", so the left subtraction must be
performed first. When we can't decide by
operator precedence alone in which order to
calculate an expression, we must use
associativity.
References
 Inspiration from Prof. Nidhi Khatri and Prof. Keyur
Suthar
 Notes of Computer Programming and Utilization
 Text book of Computer Programming and
Utilization
 Images from Google images
 Some my own knowledge
Thank You
 #include<stdio.h>
 int main()
 {
 printf(“Thank You”);
 return 0;
 }

More Related Content

What's hot

Pointer in c program
Pointer in c programPointer in c program
Pointer in c program
Rumman Ansari
 
arrays and pointers
arrays and pointersarrays and pointers
arrays and pointers
Samiksha Pun
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
Gagan Deep
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
Shaina Arora
 
Pointer in c
Pointer in cPointer in c
Pointer in c
lavanya marichamy
 
Pointers in c
Pointers in cPointers in c
Pointers in cMohd Arif
 
File in c
File in cFile in c
File in c
Prabhu Govind
 
POINTERS IN C
POINTERS IN CPOINTERS IN C
POINTERS IN C
Neel Mungra
 
Pointer in c
Pointer in cPointer in c
Pointer in c
Imamul Kadir
 
C programming - Pointers
C programming - PointersC programming - Pointers
C programming - Pointers
Wingston
 
Array Of Pointers
Array Of PointersArray Of Pointers
Array Of Pointers
Sharad Dubey
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
sai tarlekar
 
Functions in c
Functions in cFunctions in c
Functions in c
sunila tharagaturi
 
Module 05 Preprocessor and Macros in C
Module 05 Preprocessor and Macros in CModule 05 Preprocessor and Macros in C
Module 05 Preprocessor and Macros in C
Tushar B Kute
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Anil Pokhrel
 
Type casting in c programming
Type casting in c programmingType casting in c programming
Type casting in c programming
Rumman Ansari
 
C Pointers
C PointersC Pointers
C Pointers
omukhtar
 

What's hot (20)

Pointer in c program
Pointer in c programPointer in c program
Pointer in c program
 
arrays and pointers
arrays and pointersarrays and pointers
arrays and pointers
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
File in c
File in cFile in c
File in c
 
POINTERS IN C
POINTERS IN CPOINTERS IN C
POINTERS IN C
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
C programming - Pointers
C programming - PointersC programming - Pointers
C programming - Pointers
 
Array Of Pointers
Array Of PointersArray Of Pointers
Array Of Pointers
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Control structures in c
Control structures in cControl structures in c
Control structures in c
 
Module 05 Preprocessor and Macros in C
Module 05 Preprocessor and Macros in CModule 05 Preprocessor and Macros in C
Module 05 Preprocessor and Macros in C
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Typecasting in c
Typecasting in cTypecasting in c
Typecasting in c
 
Type casting in c programming
Type casting in c programmingType casting in c programming
Type casting in c programming
 
C Pointers
C PointersC Pointers
C Pointers
 

Similar to Type conversion, precedence, associativity in c programming

CP Handout#3
CP Handout#3CP Handout#3
CP Handout#3
trupti1976
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
Jasleen Kaur (Chandigarh University)
 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++bajiajugal
 
Precedence and associativity (Computer programming and utilization)
Precedence and associativity (Computer programming and utilization)Precedence and associativity (Computer programming and utilization)
Precedence and associativity (Computer programming and utilization)
Digvijaysinh Gohil
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++Danial Mirza
 
c programming2.pptx
c programming2.pptxc programming2.pptx
c programming2.pptx
YuvarajuCherukuri
 
Chapter 13.1.2
Chapter 13.1.2Chapter 13.1.2
Chapter 13.1.2patcha535
 
Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
Thesis Scientist Private Limited
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
Mohammed Saleh
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
Kathirvel Ayyaswamy
 
Input and Output Statements.pdf
Input and Output Statements.pdfInput and Output Statements.pdf
Input and Output Statements.pdf
ZahraAbdulAhmad
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
Pranali Chaudhari
 
C operators
C operatorsC operators
C operators
GPERI
 
NIKUL SURANI
NIKUL SURANINIKUL SURANI
NIKUL SURANI
Nikul4470
 
Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_castsAbed Bukhari
 
Programming Fundamentals lecture 7
Programming Fundamentals lecture 7Programming Fundamentals lecture 7
Programming Fundamentals lecture 7
REHAN IJAZ
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golang
www.ixxo.io
 
Types of c operators ppt
Types of c operators pptTypes of c operators ppt
Types of c operators ppt
Viraj Shah
 

Similar to Type conversion, precedence, associativity in c programming (20)

CP Handout#3
CP Handout#3CP Handout#3
CP Handout#3
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
2 1 expressions
2 1  expressions2 1  expressions
2 1 expressions
 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++
 
Precedence and associativity (Computer programming and utilization)
Precedence and associativity (Computer programming and utilization)Precedence and associativity (Computer programming and utilization)
Precedence and associativity (Computer programming and utilization)
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++
 
c programming2.pptx
c programming2.pptxc programming2.pptx
c programming2.pptx
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
 
Chapter 13.1.2
Chapter 13.1.2Chapter 13.1.2
Chapter 13.1.2
 
Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 
Input and Output Statements.pdf
Input and Output Statements.pdfInput and Output Statements.pdf
Input and Output Statements.pdf
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
C operators
C operatorsC operators
C operators
 
NIKUL SURANI
NIKUL SURANINIKUL SURANI
NIKUL SURANI
 
Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_casts
 
Programming Fundamentals lecture 7
Programming Fundamentals lecture 7Programming Fundamentals lecture 7
Programming Fundamentals lecture 7
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golang
 
Types of c operators ppt
Types of c operators pptTypes of c operators ppt
Types of c operators ppt
 

More from Dhrumil Panchal

YouTube Cryptocurrency Scam
YouTube Cryptocurrency ScamYouTube Cryptocurrency Scam
YouTube Cryptocurrency Scam
Dhrumil Panchal
 
This and Static Keyword
This and Static KeywordThis and Static Keyword
This and Static Keyword
Dhrumil Panchal
 
Servlet and Servlet Life Cycle
Servlet and Servlet Life CycleServlet and Servlet Life Cycle
Servlet and Servlet Life Cycle
Dhrumil Panchal
 
Properties and Indexers
Properties and IndexersProperties and Indexers
Properties and Indexers
Dhrumil Panchal
 
Chomsky Normal Form
Chomsky Normal FormChomsky Normal Form
Chomsky Normal Form
Dhrumil Panchal
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and Services
Dhrumil Panchal
 
Key roles for successful analytic project in Data Mining
Key roles for successful analytic project in Data MiningKey roles for successful analytic project in Data Mining
Key roles for successful analytic project in Data Mining
Dhrumil Panchal
 
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dhrumil Panchal
 
Different Software Testing Types and CMM Standard
Different Software Testing Types and CMM StandardDifferent Software Testing Types and CMM Standard
Different Software Testing Types and CMM Standard
Dhrumil Panchal
 
Web Design Issues
Web Design IssuesWeb Design Issues
Web Design Issues
Dhrumil Panchal
 
Toy Interpreter
Toy InterpreterToy Interpreter
Toy Interpreter
Dhrumil Panchal
 
Traditional Problems Associated with Computer Crime
Traditional Problems Associated with Computer CrimeTraditional Problems Associated with Computer Crime
Traditional Problems Associated with Computer Crime
Dhrumil Panchal
 
Breadth First Search (BFS)
Breadth First Search (BFS)Breadth First Search (BFS)
Breadth First Search (BFS)
Dhrumil Panchal
 
Timing Diagram of MVI Instruction of 8085 Microprocessor
Timing Diagram of MVI Instruction of 8085 MicroprocessorTiming Diagram of MVI Instruction of 8085 Microprocessor
Timing Diagram of MVI Instruction of 8085 Microprocessor
Dhrumil Panchal
 
File Management – File Concept, access methods, File types and File Operation
File Management – File Concept, access methods,  File types and File OperationFile Management – File Concept, access methods,  File types and File Operation
File Management – File Concept, access methods, File types and File Operation
Dhrumil Panchal
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
Dhrumil Panchal
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
Dhrumil Panchal
 
Types of Cables(Guided Media for Transmisson)
Types of Cables(Guided Media for Transmisson)Types of Cables(Guided Media for Transmisson)
Types of Cables(Guided Media for Transmisson)
Dhrumil Panchal
 
Global Service for Mobile Communication
Global Service for Mobile CommunicationGlobal Service for Mobile Communication
Global Service for Mobile Communication
Dhrumil Panchal
 
Denial of Service Attack
Denial of Service AttackDenial of Service Attack
Denial of Service Attack
Dhrumil Panchal
 

More from Dhrumil Panchal (20)

YouTube Cryptocurrency Scam
YouTube Cryptocurrency ScamYouTube Cryptocurrency Scam
YouTube Cryptocurrency Scam
 
This and Static Keyword
This and Static KeywordThis and Static Keyword
This and Static Keyword
 
Servlet and Servlet Life Cycle
Servlet and Servlet Life CycleServlet and Servlet Life Cycle
Servlet and Servlet Life Cycle
 
Properties and Indexers
Properties and IndexersProperties and Indexers
Properties and Indexers
 
Chomsky Normal Form
Chomsky Normal FormChomsky Normal Form
Chomsky Normal Form
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and Services
 
Key roles for successful analytic project in Data Mining
Key roles for successful analytic project in Data MiningKey roles for successful analytic project in Data Mining
Key roles for successful analytic project in Data Mining
 
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
 
Different Software Testing Types and CMM Standard
Different Software Testing Types and CMM StandardDifferent Software Testing Types and CMM Standard
Different Software Testing Types and CMM Standard
 
Web Design Issues
Web Design IssuesWeb Design Issues
Web Design Issues
 
Toy Interpreter
Toy InterpreterToy Interpreter
Toy Interpreter
 
Traditional Problems Associated with Computer Crime
Traditional Problems Associated with Computer CrimeTraditional Problems Associated with Computer Crime
Traditional Problems Associated with Computer Crime
 
Breadth First Search (BFS)
Breadth First Search (BFS)Breadth First Search (BFS)
Breadth First Search (BFS)
 
Timing Diagram of MVI Instruction of 8085 Microprocessor
Timing Diagram of MVI Instruction of 8085 MicroprocessorTiming Diagram of MVI Instruction of 8085 Microprocessor
Timing Diagram of MVI Instruction of 8085 Microprocessor
 
File Management – File Concept, access methods, File types and File Operation
File Management – File Concept, access methods,  File types and File OperationFile Management – File Concept, access methods,  File types and File Operation
File Management – File Concept, access methods, File types and File Operation
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
Types of Cables(Guided Media for Transmisson)
Types of Cables(Guided Media for Transmisson)Types of Cables(Guided Media for Transmisson)
Types of Cables(Guided Media for Transmisson)
 
Global Service for Mobile Communication
Global Service for Mobile CommunicationGlobal Service for Mobile Communication
Global Service for Mobile Communication
 
Denial of Service Attack
Denial of Service AttackDenial of Service Attack
Denial of Service Attack
 

Recently uploaded

Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
roli9797
 
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdf
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdfEnhanced Enterprise Intelligence with your personal AI Data Copilot.pdf
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdf
GetInData
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
74nqk8xf
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
AnirbanRoy608946
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
u86oixdj
 
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
mzpolocfi
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
TravisMalana
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
dwreak4tg
 
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdf
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdfUnleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdf
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdf
Enterprise Wired
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 

Recently uploaded (20)

Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
 
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdf
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdfEnhanced Enterprise Intelligence with your personal AI Data Copilot.pdf
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdf
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
 
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
 
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdf
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdfUnleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdf
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdf
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 

Type conversion, precedence, associativity in c programming

  • 1. WELCOME Name: Panchal Dhrumil Indravadan Activity: CPU (ALA) Branch: Computer Engineering(B.E.) Semester: Second SEM Year: 2017-18
  • 3. Contains  Type conversion  Implicit type casting  Explicit type casting  Precedence  Associativity
  • 4. Type Conversion  When an operator has operands of different types, they are converted to a common type, this known as type casting or type conversion.  Typecasting is making a variable of one data type to act like another data type such as an int to float.
  • 5. Implicit Type Casting  C automatically converts any intermediates values to the proper type so that the expression can be evaluated without losing any significance.  This automatic conversion is known as implicit type conversion.  The lower type is automatically converted to the higher type before the operation proceeds. The result is higher type.
  • 6.  Example:  If one operands is int and other is float then int will be converted to float.  If one operands is float and other is long double then float will be converted to long double.  Thus conversion happens from low data type to high data type so that information is not lost. The conversion hierarchy is shown next slide.
  • 7.
  • 8. Explicit Type Casting  Sometimes we want to force a type conversion in a way that is different from automatic conversion. The process of such a local conversion or casting is known as explicit casting.  The general form of cast is: (type-name) expression.  Where type-name is one of the standard C data type. The expression may be constant, variable, or an expression.
  • 9. Example  #include<stdio.h>  int main()  {  int sum=47, n=10;  float avg;  avg=sum / n;  printf(“Result of Implicit Type Casting: %f”, avg);  avg=(float)sum / (float)n;  printf(“Result of Explicit Type Casting: %f”, avg);  return 0;  }
  • 10. Output  Result of Implicit Type Casting: 4.000000  Result of Explicit Type Casting: 4.700000
  • 11. Precedence  Precedence of an operator is its priority in an expression for evaluation.  Operator precedence is why the expression 5 + 3 * 2 is calculated as 5 + (3 * 2), giving 11, and not as (5 + 3) * 2, giving 16.  We say that the multiplication operator (*) has higher "precedence" or "priority" than the addition operator (+), so the multiplication must be performed first.
  • 12. Following table provides a complete list of operator, their precedence level, and their rule of association. Rank 1 indicates highest precedence level and 15 is the lowest.
  • 13. Associativity  Associativity is the left-to-right or right-to-left order for grouping operands to operators that have the same precedence.  Operator associativity is why the expression 8 - 3 - 2 is calculated as (8 - 3) - 2, giving 3, and not as 8 - (3 - 2), giving 7.  We say that the subtraction operator (-) is "left associative", so the left subtraction must be performed first. When we can't decide by operator precedence alone in which order to calculate an expression, we must use associativity.
  • 14. References  Inspiration from Prof. Nidhi Khatri and Prof. Keyur Suthar  Notes of Computer Programming and Utilization  Text book of Computer Programming and Utilization  Images from Google images  Some my own knowledge
  • 15. Thank You  #include<stdio.h>  int main()  {  printf(“Thank You”);  return 0;  }