0

What does the warning mean here?

https://code.sololearn.com/cRV3VegtaX6h/?ref=app What does operation on x is undefined mean?

5th Jul 2021, 4:45 PM
Srinath
4 Answers
+ 3
Always avoid your code with such types of calculation it may cause UB some compiler will give you warnings and its Compiler dependent . And always use different different variables so it will calculate more accurate . if you will try these calculations on java it may give you errors.
5th Jul 2021, 5:14 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
The compiler is confused just like I am. The compiler is confused whether to perform addition or increment or both. So it assumed it to be undefined in simple words. (schrodinger effect) ;) Who would write such a confusing code anyway?
5th Jul 2021, 5:37 PM
RKK
RKK - avatar
+ 1
rkk Oh no I didn't mean to confuse anyone haha. I just wanted to try assignment operation and increment operation on the same code. Didn't realize that not using a different variable would produce such a warning. Thanks for helping me tho ;)
6th Jul 2021, 3:52 AM
Srinath
0
A.S. got it, will try to avoid this in future codes.
6th Jul 2021, 3:53 AM
Srinath