10th Sep 2022, 8:50 AM
Kumar Anshuman
4 Answers
+ 2
you have decleared variable x =5 in cout statement you incrementing value you have yse ++ two times and remember that alway expression solve from left to right . amd in alway first pre incremt or pre decrement will solve and assign then post . so first x++ will print 5 then value increase by 1 then second x++ here thus incremented value will print means 6 but here you have written x++ again and it will print 6 then value increased by 1 means 7 which is not using anywhere in program thats why it showing warning becz you not using 7 anywhere so try to avoid such types of calculation to your program becz it generate warnings and also its depend on compiler how it solve
10th Sep 2022, 9:52 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Kumar Anshuman int x = 5; int y = x++; //first assign then increment by 1 cout << y; //5 cout << x; //6
10th Sep 2022, 8:53 AM
AĶ¢J
AĶ¢J - avatar
0
I also wrote this code on GeeksforGeeks compiler and there it shows 65 as the output without any warning. But here it shows 56 with a warning. Why? Please explain.
10th Sep 2022, 8:52 AM
Kumar Anshuman
10th Sep 2022, 9:21 AM
Kumar Anshuman