Professional Documents
Culture Documents
Aydid Mohamed Ahmed 1693108 Bsit CC103: Answers
Aydid Mohamed Ahmed 1693108 Bsit CC103: Answers
1693108
BSIT
CC103
Answers:
1. The basic difference which distinguishes type casting from type conversion is
that type casting is conversion of one type to another, done by the programmer
On the other hand, the type conversion is conversion of one type to another,
done by the compiler while compiling.
Type casting can be applied to the data types which may not be compatible with
each other but, type conversion can only be applied to the data types which are
compatible with each other. The conversion of one type to another in type casting
requires the casting operator “( )” while, the conversion of one data type to
another in type conversion do not require any operator. While converting one
data type to another in type casting, the destination type can be larger or smaller
than the source type. On the other hand, the destination type must be larger than
the source type in type conversion. The conversion of one type to another type is
done while coding in type casting whereas, in type conversion, the conversion of
one type to another is done explicitly during compilation. Type casting is called
narrowing conversion because here the destination type can be smaller than
source type whereas, type conversion is called widening conversion because
here, the destination type must be larger than the source type.
https://techdifferences.com/difference-between-type-casting-and-type-
conversion.hltm
A; EXAMPLE TYPECASTING:
Int a;
byte b;
...
...
b= (byte) a;
EXAMPLE TYPECONVERSION
int a=3;
float b;
b=a; // value in b=3.000.
Function call: Of course, you want to use the function that you create in
your program. A
Function represents a single value, such as an integer or a double-precision
Number, so you can treat the function name as a variable.