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

2019-02-26 12:53发布

Please tell me the answer with explanation:

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

main(){
  printf("%d",f(100,10));
}

1条回答
贪生不怕死
2楼-- · 2019-02-26 13:44

## 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".

查看更多
登录 后发表回答