when u use post increment operator in an expression and there is sequence point like || or && then value of post increment counted in expression other wise not
On Mon, Jul 4, 2011 at 11:24 AM, Navneet Gupta <navneetn...@gmail.com>wrote: > I think one rule of thumb for reading pre and post increment operators is > > 1) For Pre - Increment the value and use it (++x) > 2) For Post - Use the value and increment it (x++) > > Similar is for pre and post decrement. > > I am not very good at commenting the generality of above but in simple > usages like below, the above work well for me. > > On Mon, Jul 4, 2011 at 11:21 AM, Anantha Krishnan > <ananthakrishnan....@gmail.com> wrote: > > y=*x++; > > this line executes like this: > > > > y=*x; > > x=x+1; // post increment > > Regards > > Anantha Krishnan > > On Mon, Jul 4, 2011 at 10:36 AM, amit kumar <amitthecoo...@gmail.com> > wrote: > >> > >> i think d answer sud be 10. > >> but it comes out to be 5. > >> xplain plz > >> > >> On Mon, Jul 4, 2011 at 10:30 AM, Sandeep Jain <sandeep6...@gmail.com> > >> wrote: > >>> > >>> Apoorve, please explain the reason for this output as well > >>> > >>> > >>> Regards, > >>> Sandeep Jain > >>> > >>> > >>> > >>> > >>> On Mon, Jul 4, 2011 at 1:06 AM, Apoorve Mohan <apoorvemo...@gmail.com> > >>> wrote: > >>>> > >>>> 5 > >>>> > >>>> On Mon, Jul 4, 2011 at 1:01 AM, amit the cool < > amitthecoo...@gmail.com> > >>>> wrote: > >>>>> > >>>>> int main() > >>>>> { > >>>>> int a[]={5,10,15,8}; > >>>>> int *x=a; > >>>>> int y; > >>>>> y=*x++; > >>>>> printf("%d",y); > >>>>> } > >>>>> > >>>>> -- > >>>>> 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 at > >>>>> http://groups.google.com/group/algogeeks?hl=en. > >>>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> regards > >>>> > >>>> Apoorve Mohan > >>>> > >>>> -- > >>>> 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 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 algogeeks@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. > >> > >> -- > >> 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 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 algogeeks@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. > > > > > > -- > Navneet > > -- > 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 at > http://groups.google.com/group/algogeeks?hl=en. > > -- **With Regards Deoki Nandan Vishwakarma * * -- 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 at http://groups.google.com/group/algogeeks?hl=en.