Generally, Type Casting is the procedure or a way to converting from one data type to another data type by using type casting method.
(type_name) expression
i value is 90 x value is 90.000000 i value is 65
The value of c = 1.500000
Note: Variables a, b, c belongs to integer data type, where actual result will be in float. Thus, we are typecasting the data type of variable 'c' from an int ⇨ float.
Implicit type casting means conversion of data types without losing its original meaning. This type of typecasting is essential when you want to change data types without changing the significance of the values stored inside the variable.
Implicit type conversion happens automatically when a value is copied to its compatible data type.
10 10
Consider the example of adding a character decoded in ASCII with an integer:
Value of sum : 108
In implicit type conversion, the data type is converted automatically.
(data_type)expression;
Value of a is 1.200000 Value of b is 2
n = 90, k = 54 ch = F s = 70 R = 5.200000 P = 5 M = 3.333333, m =3