+ 2
Please let me know why this error occurs!
int a=2; cout<< a++++; //lvalue required as increment operand.
5 Respostas
+ 4
Is it like,
(a++) + (++) ?
What does it mean?
But if you wrote
(a++) + (++a) (output : 6)
or,
(a++) + (a++) (output : 5)
Then it's making more sense right?
But wait ✋
This will throw warning because it is unspecified whether (a++) or (++a) will be evaluated first.
As I'm not a c++ expert so for further info on Sequence point I'll suggest you to go through this article👇
https://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points
+ 3
How did you increment like that lol .
There's no ++++operator .
Either use pre increment or post increment operator .
Eg : As in your Qstn let a=2;
cout<<a++; is fine //outputs 2
cout<<++a; //outputs 3
+ 2
hiii i want to take input elements from user and show that elements only using single for loop...
+ 1
Alphin K Sajan Many thanks for your answer. But i once saw this in a question! I know temp copy is used in postfix but not in prefix. So postfix is rather tricky! I just want to know trick of step by step bro! I want to be more ckear!
0
you are probably working with a long code so I can't say exactly what the problem is but look at this I hope it will help you
https://stackoverflow.com/questions/19068549/error-lvalue-required-as-increment-operand
https://stackoverflow.com/questions/18819570/error-operand-for-operator-must-be-an-lvalue
https://stackoverflow.com/questions/3364445/lvalue-required-as-increment-operand
hope you can make sense of it