The stringizing operator in the (ANSI C and C++) C preprocessor. It puts quotes around x (which should be a #define macro variable). So after
#define NL(x) (#x "\n")
we can say printf(NL(Look no newline!)); and have it print the string "Look no newline!\n".

This is occasionally useful (see ## for a piece of code based on production code I wrote that can use this).

If you want to stringize the contents of a macro (say, if you #define X 12 and you want to get the string "12"), you need to use the stringize macro macro hack.

Log in or register to write something here or to contact authors.