(C++) Why
std::cout << ++(a++);
shows error: lvalue required as increment operand
but
std::cout << (++a)++;
shows output "1"
(Java) But in Java in both the cases it throws exception. Cause increment and decrement operators work on variable not on values. And output of parentheses operator is always value.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire