| 
View
 

StringizeArgs

Page history last edited by Kenneth Finnegan 16 years, 7 months ago

I can't quite come up with a use case for this, but I also didn't know it existed until this week.  The # symbol in a macro will convert an argument into a string.

 

Code:

#define Example(arg) if(arg==0) printf("Example: " #arg " equals zero\n");

 

Usage:

 

 


Extensions:

 


Sources:

http://c-faq.com/ansi/macstrexp.html

http://c-faq.com/ansi/stringize.html

Comments (0)

You don't have permission to comment on this page.