- 1
Am I right? Correct me if I am wrong.
#include <stdio.h> int main() { int a=3; printf("%d %d",a,a++); } Output : 4,3 Because Increment operators having more precedence than assignment operator.
3 Answers
+ 1
You can run the code and check the output yourself:
Go to Code section, click +, select the programming language, insert your code, run it
+ 1
if you are about why that output? then :
There is no precedence taking place as your code have no compound operator statements in single instruction but have compound statement that are executed by compiler dependend. It may not result same in different compilers. So it has sequence point issue.
For sequence point issue in c/c++:
https://en.m.wikipedia.org/wiki/Sequence_point
&
https://www.sololearn.com/Discuss/2038766/?ref=app
For post/pre increments
https://www.sololearn.com/Discuss/1690694/?ref=app
Hope these helps..
+ 1
Thank you for your answers.