How does the increment operator work in an if statement?

前端 未结 7 1472
感情败类
感情败类 2021-01-13 14:16
    #include 

    int main()
    {
        int x = 0;

        if (x++)
            printf(\"true\\n\");
        else if (x == 1)
            printf(         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-13 14:51

    I believe this simply could fix the error

    
    #include 
    
        int main()
        {
            int x = 0;
    
            if (++x)
                printf("true\n");
            else if (x == 1)
                printf("false\n");
            return 0;
        }
    

提交回复
热议问题