From: "Marius Cosma" <marius.cosma@computaris.com>
To: linux-c-programming@vger.kernel.org
Subject: RE: Macro exercise
Date: Fri, 18 Aug 2006 12:12:10 +0300 [thread overview]
Message-ID: <01b501c6c2a6$62fdfcd0$b361a8c0@COSMA> (raw)
In-Reply-To:
Hello,
I want to use a macro for a structure member, something like:
typedef struct {
int a;
int b;
int c;
} myStruct;
myStruct x;
x.a = 7;
x.b = 8;
x.c = 9;
#undef PARAM
#define PARAM a
printf("x=%d\n", x.##PARAM);
#undef PARAM
#define PARAM b
printf("x=%d\n", x.##PARAM);
#undef PARAM
#define PARAM c
printf("x=%d\n", x.##PARAM);
But I'm having problems in writing it correct (that "x.##PARAM"). Are you
faster than a google search? :)
Thanks
This email is subject to Computaris email terms of use: http://www.computaris.com/email_terms.html
next reply other threads:[~2006-08-18 9:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-18 9:12 Marius Cosma [this message]
2006-08-18 9:19 ` Macro exercise Marius Cosma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='01b501c6c2a6$62fdfcd0$b361a8c0@COSMA' \
--to=marius.cosma@computaris.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).