ossam link...thnx..vikram On Tue, Oct 30, 2012 at 3:20 PM, Vikram Pradhan <vpradha...@gmail.com>wrote:
> Macro arguments are scanned and expanded before the substitution in macro > body unless they are convert to a string representation (using #) or > concatenated with other tokens (using ##). > > Xstr(oper) => Xstr(multiply) =>str(multiply)=>"multiply" // in > Xstr(x) , x is a simple argument so it will expand fully > > str(oper) =>"oper" // in str(x) , x is converting to string so it > will not get expanded > > check this link : > http://gcc.gnu.org/onlinedocs/cpp/Argument-Prescan.html#Argument-Prescan > > > > > On Sun, Oct 28, 2012 at 3:28 PM, rahul sharma <rahul23111...@gmail.com>wrote: > >> And when char *opername=str(oper); >> >> then o/p is oper....why behaviour is diff. in 2 cases >> >> On Sun, Oct 28, 2012 at 2:53 PM, rahul sharma <rahul23111...@gmail.com>wrote: >> >>> #include<stdio.h> >>> #include str(x) #x >>> #define Xstr(x) str(x) >>> #define oper multiply >>> >>> >>> int main() >>> { >>> char *opername=Xstr(oper); >>> printf("%s",opername); >>> } >>> so firstly Xstr is expanded to str(oper) >>> then str(oper) is expanded to #oper now i have read that >>> >>> If, however, a parameter name is preceded by a # in the replacement >>> text, the >>> combination will be expanded into a quoted string with the parameter >>> replaced by the actual argument...and in this case actual is also oper so >>> it becomes "oper"...so it should print oper .....i thnik i am mistaken >>> anyhre...correct??? >>> >> >> -- >> 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. >> > > > > -- > Vikram Pradhan | B.Tech| Computer Science & Engineering | NIT Jalandhar | > 9740186063 | > > -- > 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.