0 votes
in C Plus Plus by
What is the difference between type casting and type conversion?

1 Answer

0 votes
by

Type Casting

Type Conversion

The data type is converted to another data type by a programmer with the help of a casting operator.The data type is converted to another data by a compiler.
It can be applied to both compatible data types as well as incompatible data types.Type conversion can only be applied to only compatible data types.
In Type casting in order to cast the data type into another data type, a caste operator is neededIn type conversion, there is no need for a casting operator.
Type casting is more efficient and reliable.Type conversion is less efficient and less reliable than type casting.
Type casting takes place during the program design by the programmer.Type conversion is done at compile time.
Syntax: 
destination_data_type = (target_data_type) variable_to_be_converted;
Syntax: 
int a = 20; float b; b = a; // a = 20.0000

Related questions

0 votes
asked Jan 9 in C Plus Plus by GeorgeBell
0 votes
asked Jan 4 in C Plus Plus by GeorgeBell
...