446 views
3 votes
3 votes
#include<stdio.h>

int main() {
    
  int a=-1;

int c = ++a + a++ + --a;
   printf("%d ",c);
}

2 Answers

Best answer
2 votes
2 votes

i think it would help u....

The C standard states: "Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored." To do otherwise results in undefined behavior: Anything can happen.


https://www.quora.com/What-does-an-expression-involving-multiple-post-pre-decrement-increment-operators-evaluate-to-in-C-and-C++

selected by

Related questions

3 votes
3 votes
5 answers
1
arpit.bagri asked Aug 6, 2023
1,044 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; }
2 votes
2 votes
1 answer
4