+(+k--) expression in C

后端 未结 3 1435
你的背包
你的背包 2021-01-17 19:06

I saw this question in a test in which we have to tell the output of the following code.

#include

int main(){
    int k = 0;
    while(+(+k--         


        
3条回答
  •  北恋
    北恋 (楼主)
    2021-01-17 19:23

    Here's a version of this that shows operator precedence:

    +(+(k--))
    

    The two unary + operators don't do anything, so this expression is exactly equivalent to k--. The person that wrote this most likely was trying to mess with your mind.

提交回复
热议问题