Computer Science, asked by Sahilg3928, 1 year ago

What is implicit type conversion. Explain with a suitable example.

Answers

Answered by smita24
5

Implicit type conversion is an automatic type conversion done by the compiler whenever data from different types is intermixed. Implicit conversions of scalar built-in types defined in Table 4.1 (except void, double,1 and half 2) are supported. When an implicit conversion is done, it is not just a reinterpretation of the expression's value but a conversion of that value to an equivalent value in the new type.

Consider the following example:

float f = 3; // implicit conversion to float value 3.0

int i = 5.23f; // implicit conversion to integer value 5

In this example, the value 3 is converted to a float value 3.0f and then assigned to f. The value 5.23f is converted to an int value 5 and then assigned to i. In the second example, the fractional part of the float value is dropped because integers cannot support fractional values; this is an example of an unsafe type conversion.


Answered by Aditi1234srivastava
0

Answer:

Explanation:here is the answer :

Similar questions