为什么这两个方法明明不同,返回值确实相同的呢?
void uint2bytes0(byte* out_pArrBytes, uint in_uiValue)
{
out_pArrBytes[0] = (byte)(in_uiValue & 0xff);
out_pArrBytes[1] = (byte)((in_uiValue >> 8) & 0xff);
out_pArrBytes[2] = (byte)((in_uiValue >> 16) & 0xff);
out_pArrBytes[3] = (byte)((in_uiValue >> 24) & 0xff);
}
void uint2bytes1(byte* out_pArrBytes, uint in_uiValue)
{
out_pArrBytes[0] = (byte)(in_uiValue & 0xff);
out_pArrBytes[1] = (byte)((in_uiValue >> 8) & 0xff00);
out_pArrBytes[2] = (byte)((in_uiValue >> 16) & 0xff0000);
out_pArrBytes[3] = (byte)((in_uiValue >> 24) & 0xff000000);
}
坐等高手~ c++
[解决办法]
*in_pArrBytes + i
还是老老实实的用 in_pArrBytes[i] 吧,没事玩什么指针,很 cool 吗?
[解决办法]
*in_pArrBytes + i
-----------------
应该是*(in_pArrBytes + i)
这样2个函数结果就有区别了