Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language forces type conversion
C language forces type conversion
1、int a; int b; Double c = (double) a; double c =(double)b; int a =(int)c; This is a method of forced transformation.

2、long int c; (int)c; If the c variable is a long integer, then the following statement is the process of converting a long integer into an integer.

3. () is the type to be converted. Of course, the conversion between them also follows the principle of feasibility.

4. Forced conversion is also a kind of function encapsulation, which abides by certain rules and conditions. Of course, you can also construct a cast function yourself.

5. You can also convert the results of two integer operation expressions into floating-point data.