C language automatic and mandatory type conversion notes

1. Automatic type conversion in expressions. For example, when two operands perform addition, subtraction, multiplication, and division operations, the operand with a smaller value range will be converted into an operand with a larger range.
2. Automatic type conversion in assignment, the rule is: convert the value of the expression on the right into the type of the variable on the left.
3. Forced type conversion operator:
(type) expression,
note that the data type of the variable cannot be changed in this way.
4. When the function is called, declare that the parameters will be automatically forced to type conversion, such as the function prototype of sqrt, double sqrt(double);

The content of the above reference book, C language programming third edition 36-39 Su Xiaohong and C programming language second edition 36 page Brian, the book has examples to tell better, here is a record.

Guess you like

Origin blog.csdn.net/weixin_43919570/article/details/105901292