C standard says that between two sequence points object's stored value can be modified only once ( by evaluation of expression), A sequence point occurs in following conditions: 1. at the end of full expression. ( the case for your answer) 2. at the && , || , ?: operators 3. at a function call (after the evaluation of all arguments i.e just before the actual call)
Since the value of your variable is getting modified more than once between the two sequence points the result is undefined. On Sun, Nov 7, 2010 at 5:33 PM, siva viknesh <sivavikne...@gmail.com> wrote: > i compiled .. the answer is 17 !! ... its 5+5+7 ..evaluate from left > to right > > On Nov 6, 8:42 pm, bipul21 <bipuljai...@gmail.com> wrote: > > #include<stdio.h> > > int main() > > { > > int a=5; > > a=a+(a++)+(++a); > > printf("%d",a); > > return 0;} > > > > answer is 19 but how?? > > -- > 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.