Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 2
What is the difference between type casting and data type conversion? Please describe with example.
I want to know the difference between type casting and data type conversion.
2 Respostas
+ 2
Type conversion is rather implicit and is taken care by the compiler whereas type casting has to be explicitly performed in order to change one data type to other.
Eg- Type conversion
int x = 10;
float f = x;
Eg- Type casting
float f = 10.25;
int x = (int) f;
+ 4
CastingĀ is a term describing syntax (hence the Syntactic meaning).Ā ConversionĀ is a term describing what actions are actually taken behind the scenes (and thus the Semantic meaning). AĀ cast-expression is used toĀ convertĀ explicitly an expression to a given type.
Quote from https://stackoverflow.com/questions/3166840/what-is-the-difference-between-casting-and-conversion