+ 1

How to explain ds. int x = 1; int y, result; y = x; x++; result = y + x; result += x;

Programming

8th Oct 2019, 1:03 AM
Arvien Albios San Miguel
Arvien Albios San Miguel - avatar
3 ответов
8th Oct 2019, 1:46 AM
Sarthak
Sarthak - avatar
+ 1
It's simple Here x = 1 declared So y = 1 also Because y = x here we are assigning the value of x to y. Next line is x++; So here x will increase and the value of x will be 2 So now x = 2; Next line is result = y + x So result will be 1 + 2 = 3 Now next line result += x; it means result = result + x; So result will be 3 + 2 = 5;
8th Oct 2019, 1:24 AM
A͢J
A͢J - avatar
+ 1
Sarthak 🇳🇵 👍👍👍
8th Oct 2019, 1:49 AM
A͢J
A͢J - avatar