Why output is 4 in both case? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why output is 4 in both case?

I though evaluation inside printf function works right-to-left, according to this in CASE-1 output 4 is Okay, but in CASE-2 based on right-to-left it should give 3 but it giving 4! Why? Please help! CASE - 1 int main() { int a = 1, b = 1, d = 1; printf("%d", a + ++a); // Result = 4 } CASE -2 int main() { int a = 1, b = 1, d = 1; printf("%d", ++a + a); // Result = 4 }

7th Jun 2021, 1:33 PM
I Am a Baked Potato
I Am a Baked Potato - avatar
1 Answer