(转)关于数据类型转换的有趣问题
看几个例子:
short a =0xa400;
long nShift = 2;
if(a <<nShift <0)
nShift = 0;上面的程序中,nShift等于多少?
short a =0xa400;
long nShift = 2;
long b = a<<nShift;
上面程序的b最后值是多少?
short a =0xa400;
long nShift = 2;
short c = a<<nShift;上面程序中的c是什么值?
short a =0xa400;
long nShift = 2;
b = a&0x80000000;
if(b>0)
nShift = 1;上面程序中nShift的值是多少?
short a =0xa400;
long nShift = 2;
if(a <<nShift <0)
nShift = 0;
short a =0xa400;
long nShift = 2;
long b = a<<nShift;上面程序的b最后值是多少?
short a =0xa400;
long nShift = 2;
short c = a<<nShift;
short a =0xa400;
long nShift = 2;
b = a&0x80000000;
if(b>0)
nShift = 1;

浙公网安备 33010602011771号