0
#define S(x) (cout<<#x<<endl)

Using # will print whatever string, int, float I place in S(x).
For example:

S(Door Class Default Constructor);

will print

Door Class Default Constructor

I Wasn't able to find any documentation regarding it.
Explain how is it able to do so.

Shubham Sharma
  • 141
  • 1
  • 9

1 Answers1

3

It causes the expanded x to be wrapped in double quoates, "

It's often called the stringize operator and you can find more information here.

Sean
  • 60,939
  • 11
  • 97
  • 136