0
what is the output: x=15; printf("%d %d %d",x==15,x=30,x==30);
10 Answers
+ 5
Test it in multiple compilers, you will have different output. Even Code Playground warned you the risk of undefined behaviour. Another case of sequence point violation it seems.
+ 2
What you expecting output would be?
+ 2
Amit Dubey you have a code playground to check the answer. So kindly use it. If you do not understand then ask your doubt here.
+ 2
Then You are right... You expected the right..
may vary on different compilers.
here order of evaluation as you expecting happening is right to left so the output is 0 30 0.
edit:
Amit Dubey your wel come .
+ 2
yes you are right ipangš but i also used it in code blocks, then in cpp droid ..the output is same..
+ 2
I got 1 30 1 in CDroid Amit Dubey
And in Code Playground I got that sequence point warning.
What can I say? š
+ 2
Amit Dubey May be run it multiple times on different compilers, you would see different results just as Ipang said.
+ 1
If you just want to know the output, just test it out yourself, that's how one learns. If you're looking for some explanation, please be more clear about it.
Happy testing!
+ 1
expecting output : 0 30 0
0
thanks