Can anyone explain the implicit type conversion? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can anyone explain the implicit type conversion?

concepts, format etc,

2nd Oct 2017, 6:00 AM
Kartik Yadav
Kartik Yadav - avatar
2 Answers
+ 15
When an expression contains operands of different built-in types, and no explicit casts are present, the compiler uses built-in standard conversions to convert one of the operands so that the types match. (implicitly) There are two kinds of implicit conversion: 1. Widening --> int a = 50; double b = a; 2. Narrowing --> double c = 1.234567891234; float d = c; double foo = a / c; // a promoted (implicitly) to double since c is a double
2nd Oct 2017, 6:32 AM
Babak
Babak - avatar
+ 2
The definition of implicit type conversion is that one data type is converted to another data type automatically by the compiler without any cause by the programmer.
2nd Oct 2017, 6:29 AM
Deddy Tandean