variable macro in c code example

Example 1: macros in c

A macro is defined at the top of your program.
for eg: #define PI 3.14
Now whenever you write PI in your program 'PI' is replaced by 3.14
Actually this replacement is done by the preprocessor before the source code is compiled.

Example 2: how to call a function in a macro with variadic arguments c++

#define eprintf(args…) fprintf (stderr, args)

Example 3: how to call a function in a macro with variadic arguments c++

#define eprintf(…) fprintf (stderr, __VA_ARGS__)

Tags:

Misc Example