Home:ALL Converter>Why value of variable c in (c=c==c) is 2 instead of 1,in C programming?

Why value of variable c in (c=c==c) is 2 instead of 1,in C programming?

Ask Time:2019-07-26T11:30:51         Author:user9121250

Json Formatter

 #include<stdio.h>
    int main()
    {
        int a=10,b=2,c;
        a=!++b&&(c=c==c);
        printf("b value is %d \n",b);
        printf("c value is %d \n",c);
        return 0;
    }

Value of c should 1 as expression contain equality operator which gives 1 result and that result will get assigned to c i.e 1,but ouput is giving 2.Why it is so?

Author:user9121250,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/57212797/why-value-of-variable-c-in-c-c-c-is-2-instead-of-1-in-c-programming
yy