strange C macro syntax (#var)

c, macros, syntax

Solution

It's the Stringizing Operator, which converts macro parameters to string literals.

So in your example:

my_setopt(1, 2, 3)

would expand to:

_my_setopt(1, 0, config, "2", 2, 3)

Problem

What does the # symbol mean when used as a variable prefix in a #define macro? For example, ``` #define my_setopt(x,y,z) _my_setopt(x, 0, config, #y, y, z) ```

Original source