這個問題在這里已經有了答案: 運算子 |= 用于 C 中的布林值 (4 個回答) |= 在 C 中是什么意思 [重復] (2 個回答) 13 小時前關閉。
我在 C 中沒有看到運算子“|=”,如下面的代碼所示。
Word tempWord;
tempWord.m_key = my_word;
tempWord.m_att |= 4;
在 Word 定義中:
string m_key;
int32_t m_att;
這是一個簡單的任務嗎?
tempWord.m_att |= 4
在 gdb 中,我列印出 tempWord 并顯示 m_att=4。
uj5u.com熱心網友回復:
像所有復合運算子一樣,它的縮寫是:
tempword.m_att = tempword.m_att | 4;
它是一個按位或,它將在結果值中設定位 2。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/364605.html
標籤:C
上一篇:C ofstream二進制模式-書面檔案仍然看起來像純文本
下一篇:元編程-類冪函式
