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.