Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-05-03 Thread Logic King
What about the people explaining the answer above as '12'saying processing will start from left in cout and write in printf ?? On Sun, May 1, 2011 at 1:33 AM, Amit Jaspal amitjaspal...@gmail.com wrote: This is compiler dependent..and not a portable way of writing code On Sat,

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-05-01 Thread hary rathor
x=5 y=10 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-05-01 Thread Saurabh Koar
The above code is purely compiler dependent.Google Sequence Points. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-05-01 Thread Amit Jaspal
This is compiler dependent..and not a portable way of writing code On Sat, Apr 30, 2011 at 12:11 PM, Ashish Modi ashishrmod...@gmail.comwrote: For such type of questions, the best method is to draw a parse tree according to precedence and evaluate the tree. This is how it is

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-30 Thread Ashish Modi
For such type of questions, the best method is to draw a parse tree according to precedence and evaluate the tree. This is how it is evaluated at compiler level. Many times parsing tree creation is implementation dependent. On Fri, Apr 29, 2011 at 6:43 PM, Varun Nagpal

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-30 Thread MANNU
Thanks for help. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit

[algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread MANNU
*Can anyone please explain me the output of this program:* int x=1; int y=x++ + ++x + ++x + x++; couty; coutx; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread Hanlei Qin
*I can't explain it.* * * This code is evil, never coding like this. It's relate to specific C++ compiler implement. That's all my know about it. This my first post at googlegroups. Hello everyone. :) On Fri, Apr 29, 2011 at 4:31 PM, MANNU manishkr2...@gmail.com wrote: *Can anyone please

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread Manish Kumar
here y= 1+ 3+4+4= 12 and x=5 here just follow rules of postfix and prefix operator thanks manish -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group,

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread Tushar Bindal
Manish is right. This would start from the left. In cout also processing starts from left. The processing is from right in the printf statement. -- Tushar Bindal Computer Engineering Delhi College of Engineering Mob: +919818442705 E-Mail : tusharbin...@jugadengg.com Website: www.jugadengg.com

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread Hanlei Qin
Manish is right. I'm so sorry, the evil code what I said before is uglier as follows int x=1; int y=x++ + ++x + ++x - x++; couty; Forgive my careless please...:( On Fri, Apr 29, 2011 at 4:31 PM, MANNU manishkr2...@gmail.com wrote: *Can anyone please explain me the output of

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread DeVaNsH gUpTa
Yes it is correct that if we apply rules for postfix and prefix operators, the answer should be 12,5 but it is showing 10,5. So please explain this. Thanks and Regards DEVANSH GUPTA B.TECH SECOND YEAR COMPUTER SCIENCE AND ENGINEERING MNNIT ALLAHABAD -- You received this message because you are

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread Varun Nagpal
I think these questions are stupid in the sense that no one would ever use these constructs in their production code unless someone wants to write an obscure obfuscated code in some competition. Many times similar expressions are non-portable. Anyways, to understand this and related concepts,