0

There is a rule that expalin that a variable can not be upadated twice in an expression. if such things happen the result depends upon the implementation of that specific compiler .

20th Jun 2016, 1:12 AM
Utpal Kumar
Utpal Kumar - avatar
2 Réponses
0
No, there's no such rule. You can write x=a++ + ++b + --b + --a; variables 'a' and 'b' were updated more than once, and there is no mistake in this expression.
20th Jun 2016, 7:15 AM
Aseem Sharan
Aseem Sharan - avatar
0
As, Aseem said there is no mistake in his statement. But if the statement only consists of a single variable that is incremented or decremented multiple times then the variation starts to occur. Eg: x = ++x + x++ - --x + x-- In this statement x will have different values for different compilers, I.e. it is compiler implementation dependent
30th Oct 2016, 3:30 PM
Subhabrata Ghosh
Subhabrata Ghosh - avatar