1.

What Is The Concatenation Operator?

Answer»

The Concatenation operator (##) in macro is used to concatenate two arguments. Literally, we can say that the arguments are concatenated, but ACTUALLY their value are not concatenated. Think it this way, if we PASS A and B to a macro which uses ## to concatenate those two, then the result will be AB.

Consider the example to clear the confusion-

#define SOME_MACRO(a, b) a##b

MAIN()

{

int VAR = 15;

printf(“%d”, SOME_MACRO(v, AR));

}

Output of the above program will be 15.

The Concatenation operator (##) in macro is used to concatenate two arguments. Literally, we can say that the arguments are concatenated, but actually their value are not concatenated. Think it this way, if we pass A and B to a macro which uses ## to concatenate those two, then the result will be AB.

Consider the example to clear the confusion-

#define SOME_MACRO(a, b) a##b

main()

{

int var = 15;

printf(“%d”, SOME_MACRO(v, ar));

}

Output of the above program will be 15.



Discussion

No Comment Found