+ 1
C++ Increments and decrements
Hey guys Struggling like hell on incrementing and decrementing variables. It's really confusing me and I just can't get my head around the concept. int x; int y; x=5 y=x++ ????????? wtf ?!! (where would I ever use this) ? Thanks for your help
2 Respuestas
+ 3
Your coded example would probably not get used. A usable example might be having an accountNumber holding the last number assigned to an account. When you create a new account, you'd increment the number before assigning like:
Account account = new Account(++accountNumber);
+ 1
Use the search function before posting.
https://www.sololearn.com/discuss/489143/?ref=app
https://www.sololearn.com/discuss/77467/?ref=app
https://www.sololearn.com/discuss/468369/?ref=app
https://www.sololearn.com/discuss/143671/?ref=app
https://www.sololearn.com/discuss/157809/?ref=app
https://www.sololearn.com/discuss/589243/?ref=app