help with a macro

Jonathan W Miner jwm712 at unhd.unh.edu
Sun May 12 05:20:32 AEST 1991


Someone asked:
> I want a macro which adds characters before and
> after a string.

This may or may not work (depending on your compiler)
I tested it on cc (Failed) and gcc (Passed).

#define UNDERLINE(x) "_"x"_"

So: printf(UNDERLINE("hello"));

displays: _hello_

Jon.
-- 
Jonathan Miner        | I won't speak for UNH, and UNH does not 
jwm712 at unhd.unh.edu   | speak for me, but they'll charge me anyway! 
(603)868-3416         | Hacking to graduate this May!
Moving soon to miner at mervax.sanders.com  (I think?!)



More information about the Comp.lang.c mailing list