closed by
472 views
0 votes
0 votes
closed as a duplicate of: Undefined Behaviour in C

#include <stdio.h>

int main(){
  int val=10;
  int c= val+ ~val + ++val;
  printf("%d %d",c,val);
}

Output is 10 11

#include <stdio.h>
int main(){
  int val=10;
  int c= val + (~val + ++val);
  printf("%d %d",c,val);
}

output is 11 11

#include <stdio.h>
int main(){
  int val=10;
  int c=(val) + (~val + ++val);
  printf("%d %d",c,val);
}

output is 11 11

What is the difference?

closed by

Related questions

3 votes
3 votes
5 answers
1
arpit.bagri asked Aug 6, 2023
1,088 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; }
0 votes
0 votes
1 answer
3
Chhotu asked Nov 20, 2017
2,281 views
Hi,Is there any smart way to learn operator precedence table ? (means can we form some kind of logical connection instead of mugging entire table.) If some good reference...
0 votes
0 votes
1 answer
4