Type Casting

It is used to convert from one datatype to another.
There are two types.
1.Implicit type casting:- It converts automatically from one type to another.
Ex:- int to char
Write a program print a character and ascii value Printing program

Alphabets Printing program

Note:- Continue keyword is used to skip the statements.
ASCII values Printing program

2.Explicit type casting:-
With the help of typecast we can convert from one type to another.
Syntax:- datatype1 variable1=value;
Datatype2 variable2=(typecast)variable1;


No comments:

Post a Comment