String and constant #defines, Summation

dan at rna.UUCP dan at rna.UUCP
Fri Mar 2 06:32:44 AEST 1984


Hi,
	Although among the number of responses I received, none were able to
suggest a way around the...

#define	MSIZE	100
int msize = MSIZE;
char *smsize = "MSIZE";

	where I would like smsize to contain "100".

	However rlgvax!jack made a suggestion that is probably satisfactory:

#define	MSIZE(macro)	macro(100)
#define	string(x)	"x"
#define	number(x)	x

int msize = MSIZE(number);
char *smsize = MSIZE(string);

	Thanks.

						Cheers,
						Dan Ts'o
						...cmcl2!rna!dan



More information about the Comp.lang.c mailing list