Download presentation
Presentation is loading. Please wait.
Published bySuryadi Kurnia Modified over 5 years ago
1
Type Conversion It is a procedure of converting one data type values into another data type In C programming language we are having two types of type conversion 1. Implicit type Conversion 2. Explicit type Conversion
2
Implicit Type Conversion
It is a procedure of converting lower data type values into higher data type, and this is also called as widening conversion This conversion is automatically done by the compiler Eg:- int i, float f; i=234; f=i; // output:
3
. Widening conversion double float long char int short byte
4
Explicit Type Conversion
It is a procedure of converting higher data type values to lower data type , and this is also called as narrowing conversion As a programmer it is required to handle explicit type casting process
5
. Eg:- int a=10,b=3; float b=a/b; Output:- b= As this is not correct output, to get the correct output we need to go for explicit type conversion or explicit type casting i.e float b=(float)a/b; Output:
6
. double float long Narrowing Conversion char int short byte
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.