[algogeeks] Re: Help with Increment Operators in C!

2010-08-29 Thread jagadish
@Dave: Thanks alot for enlightening us! @Manju: ya.. you are right. The same was stated by me in the my prev reply! :-) On Aug 29, 10:50 pm, Manjunath Manohar manjunath.n...@gmail.com wrote: it is compiler dependant da..the evaluation of this kind of expressions -- You received this message

[algogeeks] Re: Help with Increment Operators in C!

2010-08-28 Thread Chi
In php it is 19. ?php $x=5; printf(%d,($x++ + ++$x + $x++)); ? On Aug 28, 1:35 pm, jagadish jagadish1...@gmail.com wrote: I ran this code.. int main() { int x=5; printf(%d,(x++ + ++x + x++)); } The output printed was 18 instead of 19.. Should it not be 19? -- You received this message

[algogeeks] Re: Help with Increment Operators in C!

2010-08-28 Thread jagadish
Ya after some reading i got to know that it was implementation dependent.. And that the answer is undefined! On Aug 28, 5:07 pm, Chi c...@linuxdna.com wrote: In php it is 19. ?php $x=5; printf(%d,($x++ + ++$x + $x++)); ? On Aug 28, 1:35 pm, jagadish jagadish1...@gmail.com wrote: I ran

[algogeeks] Re: Help with Increment Operators in C!

2010-08-28 Thread Dave
Your code violates the C standard, which says: Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored. Regarding postfix