what is the value of cout<<++a + ++a + ++a if a=5; what is the value of b = ++a + ++a + ++a if a=5; cout<<b; See the difference . can any body tell why it is ? Pls help me.

the value of b=24; a is preincremented 3 times.hence the value of a=8. then those get added 8+8+8=24; the value is same in both cases ;

k i have mistaken what u have said is true for second case but for first one it will be 21 please check it out

we executed the statement(manually). it gave the same result i.e., 21. Maybe you could ask the complier to do it either c/c++