+ 1

EXPLAIN HOW OUTPUT IS 80

int main { int a=2; cout<<++a*++a*++a; return 0; }

10th Apr 2018, 3:36 PM
Mini John
Mini John - avatar
8 odpowiedzi
+ 9
well it's output is compiler dependent different compiler give different output in this possibly the code is do like this a=2; cout<<(++a*++a) *++a; so in parenthesis when value is incremented last incremented value is the value of variable which is 4 cout<<(4*4) *5; so in parenthesis when value is incremented last incremented value is the value of variable a first increment a become 3 second increment a become 4 so 4 is the value of a then next time increment then a become 5 after the parenthesis so expression is make 4*4*5 which is equal to 80 here is a similar thread by which you will found some more information https://www.sololearn.com/Discuss/1190633/?ref=app
10th Apr 2018, 4:43 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 5
oops. my answer is wrong but it works in the same way
10th Apr 2018, 3:53 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 5
wait for some time i will ask it to my expert friend
10th Apr 2018, 3:55 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 5
10th Apr 2018, 4:54 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
a is now ++a(3)*++a(4)*++a(5) means 3*4*5 which is equal to 80
10th Apr 2018, 3:47 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
3*4*5=60 raj chatrala
10th Apr 2018, 3:50 PM
Mini John
Mini John - avatar
+ 1
how bro
10th Apr 2018, 3:54 PM
Mini John
Mini John - avatar
0
Thanks GAWEN STEASY
11th Apr 2018, 11:15 AM
Mini John
Mini John - avatar