What's the side effect of the following macro in C ? Embedded C

前端 未结 4 1080
野趣味
野趣味 2020-12-07 02:39
#define MIN(A,B) ((A) <=  (B) ? (A) : (B))

this is the macro , I was asked what\'s the side effect if I used the following :

lea         


        
4条回答
  •  一向
    一向 (楼主)
    2020-12-07 03:05

    It evaluates p++ twice. Also, since the first evaluation changes p, the second time around it will point to a different element. So the returned value will be *(initialp + 1) or b.

    You should try it yourself.

提交回复
热议问题