0

increment operator

Cam someone explain me what does this "+=" do ?

28th Jun 2017, 10:08 PM
sargentov
sargentov - avatar
4 Respuestas
+ 2
It's equivalent to adding the current value of whatevers on the left side of the equal sign by whatever is on the right side of the equal sign. Example/ int x = 5; x += 10; This is equivalent to writing: int x = 5; x = x + (10); So x will become 15 in both cases.
28th Jun 2017, 10:14 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
x+=y means x=x+y; x-=y means x=x-y; x*=y means x=x*y; x/=y means x=x/y;
28th Jun 2017, 10:22 PM
Issa Samake
Issa Samake - avatar
+ 2
you're welcome
28th Jun 2017, 10:30 PM
Issa Samake
Issa Samake - avatar
+ 1
tanks
28th Jun 2017, 10:28 PM
sargentov
sargentov - avatar