edited by
1,094 views
0 votes
0 votes

Can someone explain why this is happening. I have found post increment has higher precedence than pre-increment . And Post increment is left associative and pre-increment is right associative.

For the 1st printf it it is 5,6

but the 2nd printf it is 6,7

Why in post increment both statemet has differenet value.

https://www.geeksforgeeks.org/c-operator-precedence-associativity/

edited by

Please log in or register to answer this question.

Related questions

375
views
2 answers
1 votes
Debargha Mitra Roy asked Apr 12
375 views
Problem Statement: Class teacher to IX-C wants to store whether a particular student has passed in exams. The class has a strength of $32$ students. Their roll ... of set bitsd. Apply Bitwise AND (&) operator and count number of set bits
1.4k
views
2 answers
6 votes
saurabh0709 asked Aug 1, 2023
1,397 views
What will be the output of the following code? _______ #include <stdio.h> int main(){ char val=250; int ans; ans= val+ !val + ~val + ++val; printf("%d", ans); return 0; }
454
views
3 answers
1 votes
Ram Swaroop asked Dec 18, 2018
454 views
Which operator has higher priority between *and / in any expression how to evaluate them
1.2k
views
5 answers
3 votes
arpit.bagri asked Aug 6, 2023
1,183 views
Why is the output of the below program 36? int main(){ int a = 1; int b = ++a * ++a * ++a; printf("%d", b ); ​​​​ return 0; }