Why it is different between -2147483648 and (int)-2147483648

前端 未结 4 413
Happy的楠姐
Happy的楠姐 2020-12-03 18:42

When I run the following code under Windows7 x64, compiled with GCC of MinGW, the result seems to be underflowed:

cout<<-2147483648 ;    //Output: 2147         


        
4条回答
  •  猫巷女王i
    2020-12-03 19:16

    Actually I found an explaination from a pdf file of CS:APP which perfectly give the solution, you can download it from here. http://www.csapp.cs.cmu.edu/public/waside/waside-tmin.pdf

提交回复
热议问题