Macros in ANSI C

Mojy Mirashrafi mojy at iSC.intel.com
Sat Mar 2 04:27:19 AEST 1991


Here is my question:

In the old C if you wanted to define a macro to convert its parameter to a 
char you would write a macro like this:

#define conv(s) 's'

and if you used "conv(X)" in your code you would get 'X'.

In ANSI C the "'" prevents evaluation of the enclosed characters.
The above macro will expand to: 's'. Is there a way to escape the "'"s, in ANSI
C?

Thanx.



More information about the Comp.lang.c mailing list