+ 2
Explicit type conversion, even when the compiler may do automatic type conversion, is considered good programming style.
Please tell me,"what is the meaning of this sentence and what is explicit type conversion?"
3 ответов
+ 2
Type Conversion in C
A type cast is basically a conversion from one type to another. There are two types of type conversion:
Implicit Type Conversion
Also known as ‘automatic type conversion’.
Done by the compiler on its own, without any external trigger from the user.
Generally takes place when in an expression more than one data type is present. In such condition type conversion (type promotion) takes place to avoid loss of data.
All the data types of the variables are upgraded to the data type of the variable with largest data type. bool -> char -> short int -> int -> unsigned int -> long -> unsigned -> long long -> float -> double -> long double
It is possible for implicit conversions to lose information, signs can be lost (when signed is implicitly converted to unsigned), and overflow can occur (when long long is implicitly converted to float).
+ 1
+ 1
ABKAR SAIFI tnq so much