4

Please tell me the answer with explanation:

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

main(){
  printf("%d",f(100,10));
}
Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Rishabh Jain
  • 49
  • 1
  • 1
  • 2
  • 4
    possible duplicate of [Reading Zend Engine API code: What does ## (double hash) means?](http://stackoverflow.com/questions/653466/reading-zend-engine-api-code-what-does-double-hash-means). Other dups [here](http://stackoverflow.com/questions/7880058/double-hash-before-parameter-in-function-call),[here](http://stackoverflow.com/questions/15885213/use-of-double-hash-in-c) and [here](http://stackoverflow.com/questions/9059772/what-do-two-adjacent-pound-signs-mean-in-a-c-macro) – Spikatrix Apr 11 '15 at 12:18
  • 1
    this is the macro concatenation operator, it just appends the string values of g and h – amdixon Apr 11 '15 at 12:19
  • Just execte your code and you will see – Dabo Apr 11 '15 at 12:20

1 Answers1

8

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

Rahul Tripathi
  • 161,154
  • 30
  • 262
  • 319