问题描述
例如
unsigned char returnBitShift(unsigned char* bit,unsignedChar* shiftBitsToRight){
return (*bit) >> (*shiftBitsToRight);
}
unsigned char someBit = 254,bitval;
bitVal = returnBitShift(&someBit,(unsigned char)& 1);
解决方法
你可以使用复合字面量来创建一个未命名的对象,它的地址可以被获取并传递给一个函数:
bitval = returnBitShift(&someBit,& (unsigned char) {1});
复合字面量的形式是括号中的类型后跟大括号中的初始化列表。