Please I'm Struggling with these please help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please I'm Struggling with these please help.

If x is 10, what are the values of x and y after the statement below is executed? y = ++x + x++ / 4 * (3 + x++); y = ? x = ? If x is 10, what are the values of x and y after the statement below is executed? y = x++ % 5 - --x * ++x; y = ? x = ? can you show solution i'm struggling with these pleasee :)

14th Sep 2021, 7:10 AM
Hanz Rosales
Hanz Rosales - avatar
1 Answer
0
y = ++x(11) + x++(11) / 4 * (3 + x++(12)) x = 13; y = 41; It is all about post and pre increment when you do ++x it is pre increment and u are using the incremented value (you using the value after u increment it). when you do x++ you are incrementing the value but using the older version for example int J = 9; std::cout << J++; // 9 std::cout << J;//10 I hop It help
14th Sep 2021, 7:22 AM
Eyob
Eyob - avatar