Dont use this practice in your lifetime | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Dont use this practice in your lifetime

Using ++ and -- in single expression for same variable is to be strictly avoided. Although it is less possible to predict the output of such expressions, it should be avoided by any programmer, irrespective of the language. It will cause an Undefined Behaviour. a = 3; b = 2; x = ++a - --a + (b* ++a); While the usage of this expression wont cause any Compilation or System error, because it is syntactically correct, it will surely cause Logical errors, giving different results in different OS, compiler.

18th Jul 2017, 3:12 PM
Food
Food - avatar
2 Answers
+ 4
a++ is STRONGLY RECOMENDED instead of a += 1; or a = a + 1;
18th Jul 2017, 3:15 PM
DV
DV - avatar
0
well they are complicated but they are executed fastly than the normal expression.
18th Jul 2017, 3:18 PM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar