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

  • Work with all your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in one place. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!

View
 

StringizeArgs

Page history last edited by Kenneth Finnegan 13 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.