| Forum |
|
|||||||
| Software Q&A Having trouble with software? Find solutions here |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Right Off the Assembly Line
Join Date: Jan 2007
Location: edge of hell.
Posts: 12
|
i today found that "Microsoft Visual C++" v6.0 on which i performed most of my c and c++ projects, has a bug. i cud not believe it, it was a total annoy for me. run this problem on MSVisualC++: Code:
int x=5,y; y=++x + ++x; cout<<y; in tc++ however it gives the correct output as 13, also 13 on C# compiler. Now can anyone here try to clarify why MSVisualC++ gave wrong output? ? |
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#4 (permalink) | |
|
String Phreak
Join Date: Mar 2005
Location: In ur Evil Mind!
Posts: 2,453
|
No, the output shud be 14.
I have lost touch in C++, but AFAIK for "++x" , the increment is done before the execution of the whole line. Likewise for "x++", the increment is done after the execution of the whole line. Try this out n observe! Quote:
__________________
Bad Bad server.....No candy for u! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|