Computer Science, asked by ag7688066676, 2 months ago

what s explicit type casting (or type conversion)? give one example.​

Answers

Answered by freedarajesh2003
0

Answer:

Explanation:

Implicit type casting

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. During conversion, strict rules for type conversion are applied. If the operands are of two different data types, then an operand having lower data type is automatically converted into a higher data type. This type of type conversion can be seen in the following example.

In the given example, we have declared a variable of short data type with value initialized as 10.

On the second line, we have declared a variable of an int data type.

On the third line, we have assigned the value of variable s to the variable a. On third line implicit type conversion is performed as the value from variable s which is of short data type is copied into the variable a which is of an int data type.

Answered by jeonjk0
0

Answer:

Explicit type conversion is a type conversion which is explicitly defined within a program (instead of being done by a compiler for implicit type conversion). It is defined by the user in the program

Explanation:

An example of typecasting is converting an integer to a string. This might be done in order to compare two numbers, when one number is saved as a string and the other is an integer. For example, a mail program might compare the first part of a street address with an intege

Similar questions