retagged by
780 views
4 votes
4 votes

Consider the following Program:-

#include <stdio.h>
int main()
{
    short a = 1, b = 1, c = 1, d;
    d = ((a++ || b++ && c++) || 1);
    printf("a= %d, b = %d, c= %d, d= %d", a,b,c,d);
    return 0;
}

Output:-

a = 2, b = 1, c = 1, d = 1;

Even though the precedence of AND is greater than that of OR, which means && should be executed before ||, but it is not happening. Why??

retagged by

Please log in or register to answer this question.

Related questions

2 votes
2 votes
0 answers
1
kapil pandey asked Sep 29, 2016
528 views
how (a+++b) evaluated, either (a++) +b or a+(++b)
1 votes
1 votes
0 answers
2
Akash Mishra asked Jan 22, 2018
356 views
What would p++ - c be?(p++) - cor(p - c)++Please provide an explanation.
2 votes
2 votes
1 answer
3
1 votes
1 votes
1 answer
4
nish kim asked Sep 2, 2017
5,352 views
{double b =5 & 3 && 4 || 6 | 6 ;printf("%lf",b);}a.2.000000b.1.0c.1.000000d.compilation error