ohk i try to xplain , first u understand abt two macros operator # operator makes string like
#define g(a) *#*a WTEVER value of a will come ,this operator wil convert that into string noe 2nd operator is concatenation one like #define f(a,b) a*##*b here a and b wil get concatenated to form string but ths question test also the order of evalaution of fucntion like h(f(1,2)) first h macro wil get called and then it wil become g(f(1,2)) but now it wil call f(1,2) macro so tht makes g(12) n now g macro makes it 12 fr 2nd part g(f(1,2)) it calls g macro n converts it into string "f(1,2)" so here f macor wil nt get called as it has convereted into string :) cheers On Sat, Feb 5, 2011 at 12:50 AM, priya mehta <priya.mehta...@gmail.com>wrote: > thats amazing :) :) > but i wanted to know the explanation dear. > > > On Sat, Feb 5, 2011 at 12:49 AM, rajat ahuja > <catch.rajatah...@gmail.com>wrote: > >> 12 >> and >> f(1,2) >> >> On Sat, Feb 5, 2011 at 12:46 AM, priya mehta <priya.mehta...@gmail.com>wrote: >> >>> #include <stdio.h> >>> #define f(a,b) a*##*b >>> >>> >>> >>> #define g(a) *#*a >>> >>> >>> >>> #define h(a) g(a) >>> >>> >>> >>> *int* main() >>> { >>> printf("%s\n",h(f(1,2))); >>> >>> >>> >>> printf("%s\n",g(f(1,2))); >>> >>> >>> >>> *return* 0; >>> } >>> >>> -- >>> 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<algogeeks%2bunsubscr...@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<algogeeks%2bunsubscr...@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<algogeeks%2bunsubscr...@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.