Question with cpp and token pasting

Stan Brown browns at iccgcc.decnet.ab.com
Sat Feb 2 06:24:20 AEST 1991


In article <1991Jan30.232740.1697267 at locus.com>, bringo at locus.com (Bob Ringo) writes:
> Hi, this is probably a simple task, but I haven't figured it out.
> I'd like to do the following:
> 
> #define A "Good"
> #define B "Morning"
> #define C   /* the concatenation of A and B */

Assuming A and B will always be literal strings, you can use either
    #define C A B
or
    #define C(x,y) x y

When two character strings are separated only by white space, they
aare always concatenated.

Hey--this is all my opinion, nobody else's. Rely on it at your peril.
                email: browns at ab.com -or- browns at iccgcc.decnet.ab.com
Stan Brown, Oak Road Systems, Cleveland, Ohio, USA    +1 216 371 0043



More information about the Comp.lang.c mailing list