[algogeeks] Compiler Design Help
someone please share the solution manual of compiler design by Aho (aka dragon book)... I would be very grateful. Thanks.. -- Harshal. -- 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.
Re: [algogeeks] National Instruments face to face question
binary tree On Fri, Apr 8, 2011 at 11:54 PM, ArPiT BhAtNaGaR < arpitbhatnagarm...@gmail.com> wrote: > U sure those r binary tree's & not BST > > On Sat, Apr 9, 2011 at 10:26 AM, Anand wrote: > >> 1, You have 52 cards. How will you make your you distribute cards >> randomly. >> >> 2. You have given a binary tree. Given any node, print the all the nodes >> at the same level. >> >> 3. You have given a binary tree and two given nodes. Find the distance >> between two nodes. >> >> -- >> 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. >> > > > > -- > Arpit Bhatnagar > (MNIT JAIPUR) > > -- > 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. > -- 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.
Re: [algogeeks] Re:
Rofl:D:D On Sun, Apr 10, 2011 at 12:01 AM, ArPiT BhAtNaGaR < arpitbhatnagarm...@gmail.com> wrote: > lol funniest moment of Algogeeks > > > On Sun, Apr 3, 2011 at 9:51 PM, Umer Farooq wrote: > >> hhahahahahahahhahaha Bohat aalaa sir! :D caught red-handed :D :P >> >> Ow please tell us the solution, I'm interested in knowing the answer :D >> >> >> On Sun, Apr 3, 2011 at 9:02 PM, Carl Barton >> wrote: >> >>> Haha >>> >>> >>> On 3 April 2011 15:28, Arpit Sood wrote: >>> assignment problem ? haha On Sun, Apr 3, 2011 at 7:16 PM, Dr. Deepak Garg wrote: > Beta, puchna hi tha, to mujhse puchte! > Anyways, you will get the solution in tomorrow's lecture @1pm. > I have gone through your profile. See me in my cabin after the class. > Make sure that you attend tomorrow's lecture. For now, study dynamic > programming.. > > On Apr 3, 6:03 pm, SANDEEP AAMIN wrote: > > hey guys please help me to solve this > > > > QUESTION : input a number C , an output all of the ways that a group > > of ascending positive numbers can be summed to give C. for e.g if > > C=6,the output should be > > 1+2+3 > > 1+5 > > 2+4 > > [solve using dynamic programming] > > > > please tell me about this.. > > -- > 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, Arpit Sood -- 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. >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Umer >> >> -- >> 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. >> > > > > -- > Arpit Bhatnagar > (MNIT JAIPUR) > > -- > 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. > -- 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.
[algogeeks] Re: website feedback
this is cool!! the updates are causing the browser to slow down.. or may be too many requests.. can we control thta? updated every 3 seconds? Good work!! -- 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.
Re: [algogeeks] Re:
lol funniest moment of Algogeeks On Sun, Apr 3, 2011 at 9:51 PM, Umer Farooq wrote: > hhahahahahahahhahaha Bohat aalaa sir! :D caught red-handed :D :P > > Ow please tell us the solution, I'm interested in knowing the answer :D > > > On Sun, Apr 3, 2011 at 9:02 PM, Carl Barton wrote: > >> Haha >> >> >> On 3 April 2011 15:28, Arpit Sood wrote: >> >>> assignment problem ? haha >>> >>> >>> On Sun, Apr 3, 2011 at 7:16 PM, Dr. Deepak Garg wrote: >>> Beta, puchna hi tha, to mujhse puchte! Anyways, you will get the solution in tomorrow's lecture @1pm. I have gone through your profile. See me in my cabin after the class. Make sure that you attend tomorrow's lecture. For now, study dynamic programming.. On Apr 3, 6:03 pm, SANDEEP AAMIN wrote: > hey guys please help me to solve this > > QUESTION : input a number C , an output all of the ways that a group > of ascending positive numbers can be summed to give C. for e.g if > C=6,the output should be > 1+2+3 > 1+5 > 2+4 > [solve using dynamic programming] > > please tell me about this.. -- 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, >>> Arpit Sood >>> >>> -- >>> 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. >>> >> >> -- >> 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. >> > > > > -- > Umer > > -- > 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. > -- Arpit Bhatnagar (MNIT JAIPUR) -- 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.
Re: [algogeeks] please explain the output
thx pratik On Sat, Apr 9, 2011 at 8:13 PM, Pratik Kathalkar wrote: > u can see the pre-processed file using gcc -E prog_name.cand @ > bottom u can see what actually the code is doing. > > > On Tue, Apr 5, 2011 at 12:45 PM, Arvind wrote: > >> #include >> >> #define f(a,b) a##b >> #define g(a) #a >> #define h(a) g(a) >> >> int main() >> { >> printf("%s",g(f(1,2))); >> printf("\t%s",h(f(1,2))); >> return 0; >> } >> >> >> >> i have run this program in gcc compiler and getting : f(1,2) 12 as >> output. >> can anyone explain the reason for getting this output? >> >> -- >> 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. >> >> > > > -- > Pratik Kathalkar > CoEP > BTech IT > 8149198343 > > > -- > 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. > -- Arpit Bhatnagar (MNIT JAIPUR) -- 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.
Re: [algogeeks] website feedback
its really really coolll i love it can u tell somtnhg how to develop things like that some idea On Sat, Apr 9, 2011 at 10:08 PM, Carl Barton wrote: > Either way, it's a pretty boring idea. > > > On 9 April 2011 16:06, hary rathor wrote: > >> is it not some kind of fishing page ? >> >> -- >> 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. >> > > -- > 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. > -- Arpit Bhatnagar (MNIT JAIPUR) -- 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.
Re: [algogeeks] website feedback
Either way, it's a pretty boring idea. On 9 April 2011 16:06, hary rathor wrote: > is it not some kind of fishing page ? > > -- > 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. > -- 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.
Re: [algogeeks] website feedback
is it not some kind of fishing page ? -- 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.
Re: [algogeeks] please explain the output
u can see the pre-processed file using gcc -E prog_name.cand @ bottom u can see what actually the code is doing. On Tue, Apr 5, 2011 at 12:45 PM, Arvind wrote: > #include > > #define f(a,b) a##b > #define g(a) #a > #define h(a) g(a) > > int main() > { > printf("%s",g(f(1,2))); > printf("\t%s",h(f(1,2))); > return 0; > } > > > > i have run this program in gcc compiler and getting : f(1,2) 12 as > output. > can anyone explain the reason for getting this output? > > -- > 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. > > -- Pratik Kathalkar CoEP BTech IT 8149198343 -- 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.
[algogeeks] Re: please explain the output
Crystal Clear. Nicely explained. Thanks! On Apr 5, 3:40 pm, Azhar Hussain wrote: > Few Important things about macros, before I explain the output > 1. Macros are replaced in passes. > 2. Macros are not recursive. > > regarding the output remember the rule for expansion > "A parameter in the replacement list, *UNLESS* preceded by a # or ## > preprocessing token or followed by a ## preprocessing token, is replaced by > the corresponding argument after all macros contained therein have been > expanded". > In other words, macros are replaced "inside out" unless # or ## exists > > printf("%s",g(f(1,2))); is replaced as #f(1,2) ---> "f(1,2)" according to > the replacement rule. > printf("\t%s",h(f(1,2))); As this does not replace with # or ## directly, > "inside out" expansion leads to h("1,2") --> g('1,2") --> "1,2" > > for the first pass > printf("%s", "f(1,2)"); ---> g(a) #a > printf("\t%s", h("1,2")); > > second pass > printf("%s", "f(1,2)"); >> not processed(exhausted) > printf("\t%s", g("1,2")); --> h(a) g(a) > > Third pass > printf("%s", "f(1,2)"); >> not processed(exhausted) > printf("\t%s", "1,2"); --> g(a) #a > > Hope this answers your question. > > - > Azhar. > > On Tue, Apr 5, 2011 at 3:22 PM, Vandana Bachani wrote: > > > > > > > > > Hi Arvind, > > These are preprocessor specific operators. Check out > >http://msdn.microsoft.com/en-us/library/wy090hkc(v=vs.80).aspx > > > -Vandana > > > On Tue, Apr 5, 2011 at 12:45 PM, Arvind wrote: > > >> #include > > >> #define f(a,b) a##b > >> #define g(a) #a > >> #define h(a) g(a) > > >> int main() > >> { > >> printf("%s",g(f(1,2))); > >> printf("\t%s",h(f(1,2))); > >> return 0; > >> } > > >> i have run this program in gcc compiler and getting : f(1,2) 12 as > >> output. > >> can anyone explain the reason for getting this output? > > >> -- > >> 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. > > > -- > > 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. -- 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.
[algogeeks] Re: please explain the output
On Apr 5, 3:40 pm, Azhar Hussain wrote: > Few Important things about macros, before I explain the output > 1. Macros are replaced in passes. > 2. Macros are not recursive. > > regarding the output remember the rule for expansion > "A parameter in the replacement list, *UNLESS* preceded by a # or ## > preprocessing token or followed by a ## preprocessing token, is replaced by > the corresponding argument after all macros contained therein have been > expanded". > In other words, macros are replaced "inside out" unless # or ## exists > > printf("%s",g(f(1,2))); is replaced as #f(1,2) ---> "f(1,2)" according to > the replacement rule. > printf("\t%s",h(f(1,2))); As this does not replace with # or ## directly, > "inside out" expansion leads to h("1,2") --> g('1,2") --> "1,2" > > for the first pass > printf("%s", "f(1,2)"); ---> g(a) #a > printf("\t%s", h("1,2")); > > second pass > printf("%s", "f(1,2)"); >> not processed(exhausted) > printf("\t%s", g("1,2")); --> h(a) g(a) > > Third pass > printf("%s", "f(1,2)"); >> not processed(exhausted) > printf("\t%s", "1,2"); --> g(a) #a > > Hope this answers your question. > > - > Azhar. > > On Tue, Apr 5, 2011 at 3:22 PM, Vandana Bachani wrote: > > > > > > > > > Hi Arvind, > > These are preprocessor specific operators. Check out > >http://msdn.microsoft.com/en-us/library/wy090hkc(v=vs.80).aspx > > > -Vandana > > > On Tue, Apr 5, 2011 at 12:45 PM, Arvind wrote: > > >> #include > > >> #define f(a,b) a##b > >> #define g(a) #a > >> #define h(a) g(a) > > >> int main() > >> { > >> printf("%s",g(f(1,2))); > >> printf("\t%s",h(f(1,2))); > >> return 0; > >> } > > >> i have run this program in gcc compiler and getting : f(1,2) 12 as > >> output. > >> can anyone explain the reason for getting this output? > > >> -- > >> 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. > > > -- > > 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. -- 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.
Re: [algogeeks] please explain the output
nice explanation -- 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.
[algogeeks] Brain Teaser Digest Of The Week 4thApril-8th April
Hi *Puzzle Digest Of The Week 4thApril-8th April* *http://dailybrainteaser.blogspot.com/2011/04/2april.html?lavesh=lavesh* * * *http://dailybrainteaser.blogspot.com/2011/04/5april.html?lavesh=lavesh* * * *http://dailybrainteaser.blogspot.com/2011/04/6april.html?lavesh=lavesh* * * *http://dailybrainteaser.blogspot.com/2011/04/7april.html?lavesh=lavesh* * * *http://dailybrainteaser.blogspot.com/2011/04/8april.html?lavesh=lavesh* *Please subscribe and follow this blog to show your liking to the blog.* -- 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.
[algogeeks] Re: please explain the output
nice explanation On Apr 9, 1:15 pm, ArPiT BhAtNaGaR wrote: > COOL BRO THIS IS A GOOD SOLN > > > > > > > > > > On Tue, Apr 5, 2011 at 4:10 PM, Azhar Hussain wrote: > > Few Important things about macros, before I explain the output > > 1. Macros are replaced in passes. > > 2. Macros are not recursive. > > > regarding the output remember the rule for expansion > > "A parameter in the replacement list, *UNLESS* preceded by a # or ## > > preprocessing token or followed by a ## preprocessing token, is replaced by > > the corresponding argument after all macros contained therein have been > > expanded". > > In other words, macros are replaced "inside out" unless # or ## exists > > > printf("%s",g(f(1,2))); is replaced as #f(1,2) ---> "f(1,2)" according to > > the replacement rule. > > printf("\t%s",h(f(1,2))); As this does not replace with # or ## directly, > > "inside out" expansion leads to h("1,2") --> g('1,2") --> "1,2" > > > for the first pass > > printf("%s", "f(1,2)"); ---> g(a) #a > > printf("\t%s", h("1,2")); > > > second pass > > printf("%s", "f(1,2)"); >> not processed(exhausted) > > printf("\t%s", g("1,2")); --> h(a) g(a) > > > Third pass > > printf("%s", "f(1,2)"); >> not processed(exhausted) > > printf("\t%s", "1,2"); --> g(a) #a > > > Hope this answers your question. > > > - > > Azhar. > > > On Tue, Apr 5, 2011 at 3:22 PM, Vandana Bachani > > wrote: > > >> Hi Arvind, > >> These are preprocessor specific operators. Check out > >>http://msdn.microsoft.com/en-us/library/wy090hkc(v=vs.80).aspx > > >> -Vandana > > >> On Tue, Apr 5, 2011 at 12:45 PM, Arvind wrote: > > >>> #include > > >>> #define f(a,b) a##b > >>> #define g(a) #a > >>> #define h(a) g(a) > > >>> int main() > >>> { > >>> printf("%s",g(f(1,2))); > >>> printf("\t%s",h(f(1,2))); > >>> return 0; > >>> } > > >>> i have run this program in gcc compiler and getting : f(1,2) 12 as > >>> output. > >>> can anyone explain the reason for getting this output? > > >>> -- > >>> 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. > > >> -- > >> 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. > > > -- > > 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. > > -- > Arpit Bhatnagar > (MNIT JAIPUR) -- 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.
Re: [algogeeks] please explain the output
COOL BRO THIS IS A GOOD SOLN On Tue, Apr 5, 2011 at 4:10 PM, Azhar Hussain wrote: > Few Important things about macros, before I explain the output > 1. Macros are replaced in passes. > 2. Macros are not recursive. > > regarding the output remember the rule for expansion > "A parameter in the replacement list, *UNLESS* preceded by a # or ## > preprocessing token or followed by a ## preprocessing token, is replaced by > the corresponding argument after all macros contained therein have been > expanded". > In other words, macros are replaced "inside out" unless # or ## exists > > printf("%s",g(f(1,2))); is replaced as #f(1,2) ---> "f(1,2)" according to > the replacement rule. > printf("\t%s",h(f(1,2))); As this does not replace with # or ## directly, > "inside out" expansion leads to h("1,2") --> g('1,2") --> "1,2" > > for the first pass > printf("%s", "f(1,2)"); ---> g(a) #a > printf("\t%s", h("1,2")); > > second pass > printf("%s", "f(1,2)"); >> not processed(exhausted) > printf("\t%s", g("1,2")); --> h(a) g(a) > > Third pass > printf("%s", "f(1,2)"); >> not processed(exhausted) > printf("\t%s", "1,2"); --> g(a) #a > > > Hope this answers your question. > > - > Azhar. > > > > > On Tue, Apr 5, 2011 at 3:22 PM, Vandana Bachani wrote: > >> Hi Arvind, >> These are preprocessor specific operators. Check out >> http://msdn.microsoft.com/en-us/library/wy090hkc(v=vs.80).aspx >> >> -Vandana >> >> On Tue, Apr 5, 2011 at 12:45 PM, Arvind wrote: >> >>> #include >>> >>> #define f(a,b) a##b >>> #define g(a) #a >>> #define h(a) g(a) >>> >>> int main() >>> { >>> printf("%s",g(f(1,2))); >>> printf("\t%s",h(f(1,2))); >>> return 0; >>> } >>> >>> >>> >>> i have run this program in gcc compiler and getting : f(1,2) 12 as >>> output. >>> can anyone explain the reason for getting this output? >>> >>> -- >>> 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. >>> >>> >> -- >> 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. >> > > -- > 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. > -- Arpit Bhatnagar (MNIT JAIPUR) -- 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.