Answer to Question #186210 in C++ for Ayush parashar

Question #186210

What is difference b/w type conversion and type casting explain with code


1
Expert's answer
2021-04-27T07:16:18-0400

Type casting:-

1.In type casting, a data type is converted into another data type by a programmer using casting operator.

2.Type casting can be applied to compatible data types as well as incompatible data types.


Ex-

float x;

byte y;
....
y=(byte)x; 



Type conversion:-

1.Type conversion can only be applied to compatible datatypes.

2.Type conversion is also called widening conversion because in this, the destination data type can not be smaller than the source data type.


Ex-

 int x=30;

float y;

y=x; // y==30.000000. 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS