reopened by
582 views
2 votes
2 votes
int a = 50, b = 50;

a = a+++++b;

b = b+++++a;

Value of b after executing these .

I think it should be undefined behaviour. But in answer it is given 155. Can anybody verify it please.
reopened by

1 Answer

–1 votes
–1 votes

consider the 1st statement, b is pre increment and a is post increment

a= 50 + 51

=101 but final value of a will be 102 as post increment

simillarly 2nd statement a= 51 + 103

= 154 but final value of b will be 155 as post increment

Related questions

0 votes
0 votes
0 answers
1
Dknights asked Jan 7, 2023
284 views
0 votes
0 votes
3 answers
2
0 votes
0 votes
1 answer
3
Rahul Jain25 asked Dec 28, 2016
562 views
What will be subnet for all and also their DBA's???
0 votes
0 votes
0 answers
4