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.
