@Aditi i thnk sagar parteek is right ...in turbo compiler it's incrementing and finally max of all values and multiply the value means pre increment->evaluate->postincrement
On Fri, Aug 12, 2011 at 1:02 AM, sagar pareek <sagarpar...@gmail.com> wrote: > well its always depends on compiler to compiler > in turbo c it will first increment all x > results in > c=6*6*6 > c=216 > > but in gcc it will be as explained by me above > > > On Fri, Aug 12, 2011 at 12:56 AM, aditi garg <aditi.garg.6...@gmail.com>wrote: > >> i think it wud be undefined...the value is getting modified more than once >> and hence violating the sequence points rule...plz corect me if im wrong... >> >> >> On Fri, Aug 12, 2011 at 12:48 AM, Puneet Chawla < >> puneetchawla...@gmail.com> wrote: >> >>> In turbo compiler it's o/p is 216 and in dev it's 150.. >>> Help me out.. >>> >>> >>> On Fri, Aug 12, 2011 at 12:45 AM, sagar pareek <sagarpar...@gmail.com>wrote: >>> >>>> after expansion of macro >>>> it will be c=(++x)*(++x)*(++x); >>>> >>>> now it be solved as >>>> c= 5*5*(++x); >>>> c=25*6; >>>> c=150 >>>> >>>> >>>> On Fri, Aug 12, 2011 at 12:38 AM, Puneet Chawla < >>>> puneetchawla...@gmail.com> wrote: >>>> >>>>> #define cube(x) (x)*(x)*(x) >>>>> main() >>>>> { >>>>> int x=3,c; >>>>> c=cube(++x); >>>>> printf("%d",c); >>>>> >>>>> return 0; >>>>> } >>>>> >>>>> will anyone please tell me why o/p is 150.? >>>>> >>>>> -- >>>>> With regards >>>>> ............ >>>>> Puneet Chawla >>>>> >>>>> -- >>>>> 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 >>>> SAGAR PAREEK >>>> COMPUTER SCIENCE AND ENGINEERING >>>> NIT ALLAHABAD >>>> >>>> -- >>>> 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 >>> ............ >>> Puneet Chawla >>> Computer Engineering Student >>> NIT Kurukshetra >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Aditi Garg >> Undergraduate Student >> Electronics & Communication Divison >> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY >> Sector 3, Dwarka >> New Delhi >> >> >> -- >> 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 > SAGAR PAREEK > COMPUTER SCIENCE AND ENGINEERING > NIT ALLAHABAD > > -- > 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 ............ Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.