| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Whenever you search in PBworks or on the Web, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, Slack, and browsed web pages. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.

View
 

StringizeArgs

Page history last edited by Kenneth Finnegan 14 years, 11 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.