a= 5 , b = 6
a = (b++) + 3;
c = 2*a + (++b);
d = 2 * (++c) - (a++);
What are the values?
This is a discussion on What is this output? within the C++ Programming forums, part of the General Programming Boards category; a= 5 , b = 6 a = (b++) + 3; c = 2*a + (++b); d = 2 * ...
a= 5 , b = 6
a = (b++) + 3;
c = 2*a + (++b);
d = 2 * (++c) - (a++);
What are the values?
Try to reason out the answers then put those statements into a program and see the output for yourself.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Fix it. What is your current program?Originally Posted by xbusterx
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Can you produce the steps that you come to that conclusion from? [hint: I think it's wrong, I think I know WHERE you are going wrong, but it's much easier to explain what you are doing wrong if you actually show the individual steps of your calculation].
--
mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Why do you declare a = 5, then later a = (b++) + 3 o.O?
Currently research OpenGL