Explicit type conversion, even when the compiler may do automatic type conversion, is considered good programming style. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?"

1st Jan 2021, 2:46 PM
Crazy Challenger
Crazy Challenger - avatar
3 Answers
+ 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).
1st Jan 2021, 4:04 PM
ABKAR SAIFI
ABKAR SAIFI - avatar
1st Jan 2021, 4:05 PM
ABKAR SAIFI
ABKAR SAIFI - avatar
+ 1
ABKAR SAIFI tnq so much
4th Jan 2021, 2:53 PM
Crazy Challenger
Crazy Challenger - avatar