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 <[email protected]>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 > <[email protected]> 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 <[email protected]> > 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 <[email protected]> > >> 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 <[email protected]> > >>> wrote: > >>>> > >>>> 5 > >>>> > >>>> On Mon, Jul 4, 2011 at 1:01 AM, amit the cool < > [email protected]> > >>>> 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 [email protected]. > >>>>> To unsubscribe from this group, send email to > >>>>> [email protected]. > >>>>> 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 [email protected]. > >>>> To unsubscribe from this group, send email to > >>>> [email protected]. > >>>> 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 [email protected]. > >>> To unsubscribe from this group, send email to > >>> [email protected]. > >>> 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 [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
