/
Type Conversion Type Conversion

Type Conversion - PowerPoint Presentation

tawny-fly
tawny-fly . @tawny-fly
Follow
470 views
Uploaded On 2016-08-01

Type Conversion - PPT Presentation

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 ID: 428409

conversion type data float type conversion float data explicit output int values converting procedure casting double char short byte

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Type Conversion" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

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 ConversionSlide2

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:- 234.000000Slide3

.

Widening

conversion

byte

short

int

char

long

float

doubleSlide4

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

Slide5

.

Eg

:- int a=10,b=3;

float b=a/b;

Output:- b=3.000000 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:- 3.333333Slide6

.

byte

short

int

char

long

float

double

Narrowing

Conversion