Stringize Operator

The stringize or number-sign operator (#), when used within a macro definition, converts a macro parameter into a string constant. This operator may be used only in a macro that has a specified argument or parameter list.

When the stringize operator immediately precedes the name of one of the macro parameters, the parameter passed to the macro is enclosed within quotation marks and is treated as a string literal. For example:
#define stringer(x)  printf (#x "\n")

stringer (text)
results in the following actual output from the preprocessor.
printf ("text\n")
The expansion shows that the parameter is converted literally as if it were a string. When the preprocessor stringizes the x  parameter, the resulting line is:
printf ("text" "\n")

Because strings separated by whitespace are concatenated at compile time, these two strings are combined into "text\n".

If the string passed as a parameter contains characters that normally should be literalized or escaped (e.g., " and \), the required \ character is automatically added.