Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Inta = 2 in c language; Double b = 3+2.1; a = a+++b; printf("a=%d,b=%d\n ",a,b); What was the result? Why?
Inta = 2 in c language; Double b = 3+2.1; a = a+++b; printf("a=%d,b=%d\n ",a,b); What was the result? Why?
a=8,b= 17 179869 18

A=8 is because according to the operator priority principle of C:

A++b list and implementation A++B; A++A = A++B equals A = A+B; a++

B =1717986918 because all C/C++ compilers run according to IEEE floating-point notation. This structure is a scientific representation, represented by symbols (positive or negative), exponents and mantissas. The radix is determined to be 2, that is, a floating-point number is expressed as the mantissa multiplied by the exponential power plus sign of 2.

Therefore, the floating-point storage of 5. 1 is equivalent to the storage of integer1717986918.