- 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.

1st Jun 2022, 5:02 PM
jennifer Dsilva
3 odpowiedzi
+ 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
1st Jun 2022, 5:08 PM
Lisa
Lisa - avatar
+ 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..
1st Jun 2022, 8:04 PM
Jayakrishna 🇮🇳
+ 1
Thank you for your answers.
2nd Jun 2022, 4:01 AM
jennifer Dsilva