Square of a number being defined using #define

后端 未结 11 1180
说谎
说谎 2020-11-27 08:06

I was just going through certain code which are frequently asked in interviews. I came up with certain questions, if anyone can help me regarding this?

I am totally

11条回答
  •  执念已碎
    2020-11-27 08:30

    Because of operator precedence in the expression after the preprocessor - you'll need to write

    #define square(x) (x*x)
    

提交回复
热议问题