0
你好我有使用C宏一個問題,想知道是否有人能幫助:宏用來替換另一個宏裏面的參數用C
#define A7 PORTA,7
#define SET_BIT(x,y) x=x|(1<<y)
我試圖建立宏使得在主代碼,我可以只輸入
SET_BIT(A7); to set the 7th bit of A7
不過,我收到以下錯誤:
warning C4003: not enough actual parameters for macro 'SET_BIT'
error C2106: '=' : left operand must be l-value
error C2059: syntax error : ')'
任何幫助將是AP preciated。
我不確定是否真的將7的概念封裝到A7中...... –
@OliCharlesworth我明白,但原始海報說:設置** A7 **的第7位。所以最好的方法應該是:'定義一個PORTA,然後SET_BIT(A,7);' –