Computer Science SSC II Notes - AKUEB
8.4.5 Write the C Program to
perform implicit and explicit typecasting;
Type Casting:
Type casting, also known as type conversion, is a feature in the C programming language that allows you to convert a value of one data type into another data type. It involves changing the interpretation or representation of a value from one type to another.
Implicit Type-Casting:
Implicit type casting, also known
as automatic type conversion, occurs automatically by the compiler when there
is no loss of data or precision during the conversion. It happens when an
expression of one data type is assigned to a variable of another data type.
Lower data type to higher data type.
Explicit Type-Casting:
Explicit type casting, also known
as type conversion, is performed manually by the programmer using the cast
operator. It allows you to explicitly convert a value from one data type to
another, even if there may be a potential loss of data or precision.
Higher data
type to lower data type.
General Form: (data_type) expression
.png)
.png)
.png)
.png)
Comments
Post a Comment