Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ## mean in the #define directive in the code here

Please tell me the answer with explanation:

#define f(g,h) g##h

main(){
  printf("%d",f(100,10));
}
like image 419
Rishabh Jain Avatar asked Feb 11 '23 11:02

Rishabh Jain


1 Answers

## is used to concatenate whatever is before the ## with whatever is after it. It is used for concatenation.

You can check the reference for details

A ## operator between any two successive identifiers in the replacement-list runs parameter replacement on the two identifiers (which are not macro-expanded first) and then concatenates the result. This operation is called "concatenation" or "token pasting".

like image 62
Rahul Tripathi Avatar answered Feb 13 '23 04:02

Rahul Tripathi