Thursday, 5 September 2013

What this trick is? [duplicate]

What this trick is? [duplicate]

This question already has an answer here:
C preprocessor # and ## operators 1 answer
#define PRINT(name) print ## name
void printHE()
{
printf("Hello");
}
void printWO()
{
printf("World\n");
}
enum {
HE,
WO,
};
int main()
{
PRINT(HE);
PRINT(WO);
}
It works perfect, but why?
What ## in #define means?

No comments:

Post a Comment