# not followed by macro parameter

I have the following code:

#define MAX_NAME_LEN 15
#define PRINT_CELL(x) \
    printf("|%" #MAX_NAME_LEN "s|", #x);

When I try to compile, I get the following error:

main.c:9:21: error: '#' is not followed by a macro parameter
    9 | #define PRINT_CELL(x) \
      |                     ^

I'm not quite sure what I did wrong. How do I fix this?

Read more here: https://stackoverflow.com/questions/64939395/not-followed-by-macro-parameter

Content Attribution

This content was originally published by nswerhun at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: