C Macros
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look like when they are used Source: https://gcc.gnu.org/onlinedocs/cpp/Macros.html
Here are some useful macros:
Stringify
The idea from Linux Kernel stringify.h
.
It translates any macros into a string.
By using nested calling of macros, Preprocessor Argument Prescan does not occur, so the argument is not macro-expanded.
For more details, read the gcc doc on Stringification.
#define __stringify_1(x...) #x
#define __stringify(x...) __stringify_1(x)
#define MAX_LEN 50
scanf("%" __stringify(MAX_LEN) "s", &p);