A major drawback of Macro in C/C++ is that the arguments are strongly typed checked i.e. a macro can operate on different types of variables(like char, int ,double,..) without type checking.
// C program to illustrate macro function.
#include<stdio.h>
#define INC(P) ++P
intmain()
{
char*p = "Geeks";
intx = 10;
printf("%s ", INC(p));
printf("%d", INC(x));
return0;
}
Output:
eeks 11
Therefore we avoid to use Macro. But after the implementation of C11 standard in C programming, we can use Macro with the help of a new keyword i.e. “_Generic”. We can define MACRO for the different types of data types. For example, the following macro INC(x) translates to INCl(x), INC(x) or INCf(x) depending on the type of x: