This question already has answers here:
The need for parentheses in macros in C [duplicate]
                                
                                    (8个答案)
                                
                        
                                3年前关闭。
            
                    
想知道“ 11”是此c预处理程序指令的答案:

#define SQR(x) x*x

int main()
{
    SQR(2+3);
}

最佳答案

尝试手动扩展宏。

它将是2+3*2+3,其评估为11。

关于c - C预处理程序指令(SQR-功能),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35683670/

10-10 21:21