The output is undefined. Depends on the compiler. + is not a sequence point which may result in undefined behavior
On Sat, Aug 28, 2010 at 5:05 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 because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.