标签: c operator-keyword
我想了解C运营商|=做了什么:
|=
// Initialize the green led // Enable the clock for PORT D. See Page 216 of the Datasheet SIM_SCGC5 |= (1U<<12); // Enable the mux as GPIO. See Page 193 of the Datasheet PORTD_PCR5 = 0x100;
我也不明白0x100的含义。
0x100
答案 0 :(得分:4)
这是bitwise OR复合赋值,它与:
SIM_SCGC5 = SIM_SCGC5 | (1U<<12);
0x100 hexadecimal中的值为100,0x前缀表示十六进制值。