Computer Science, asked by chitrarameshram24, 1 month ago

Differentiate between two types of casting. Give examples of each.

Answers

Answered by yogitapatil9909
1

Answer:

1. Type Casting:

In typing casting, a data type is converted into another data type by the programmer using the casting operator during the program design. In typing casting, the destination data type may be smaller than the source data type when converting the data type to another data type, that’s why it is also called narrowing conversion.

Syntax/Declaration:-

destination_datatype = (target_datatype)variable;

(): is a casting operator.

target_datatype: is a data type in which we want to convert the source data type.

Type Casting example –

float x;

byte y;

...

...

y=(byte)x;  //Line 5

Explanation:

PLZ mark me brainlest

Similar questions