home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!agate!doc.ic.ac.uk!warwick!uknet!bcc.ac.uk!mick
- From: mick@dcs.bbk.ac.uk (Mick Farmer)
- Newsgroups: comp.lang.c
- Subject: Re: Preprocessor question
- Keywords: Preprocessor, string
- Message-ID: <mick.728072797@picus>
- Date: 26 Jan 93 18:26:37 GMT
- References: <1993Jan25.161425.27962@bnrmtl.bnr.ca>
- Organization: Bloomsbury Computing Consortium
- Lines: 15
-
- Hi,
-
- Karim asks how to get a preprocessor macro recognised inside
- a string. The answer, at least in ANSI C, is to use the
- stringising operator and string concatenation:
-
- #define JUNK 50
- static char *junk = #JUNK " ways to leave your lover"
-
- The construct #JUNK generates the string "50", which is
- concatenated with its neighbour.
-
- Regards,
-
- Mick
-