Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where do we use ## in C ? 1

Status
Not open for further replies.

olikara

Programmer
Nov 9, 2000
1
IN
Could any one help me as to how/where to use the double #
symbol (##)in c?
 
Hi,
This is how it is explained in MS help.

Token-Pasting Operator

Operator ##
Syntax token##parameter
parameter##token
----------------------------------------------------------

The token-pasting operator is used only with macros.

If ## precedes or follows a formal parameter in the definition of a macro, the actual argument is concatenated with the token on the other side of the ## when the macro is expanded. For example,

#define printvar(x) printf("%d", var##x)

causes the statement

printvar(7);

to be expanded into

printf("%d",var7);

Pappy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top