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

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

StringizeArgs

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