& operator - (nf)

olson at fortune.UUCP olson at fortune.UUCP
Thu Dec 15 10:14:12 AEST 1983


#R:iwu1a:-16200:fortune:16200013:000:584
fortune!olson    Dec 14 15:36:00 1983

I would have to disagree with chris as to what should be assigned by:
	char *in, *out, buf[];
	in = buf;
	out = &(*in++);
since he forgot the parentheses.  Given the parentheses, out SHOULD
be set buf+1; that is, 'in' is incremented BEFORE the & operator is
applied.

(The original article did not include the second line of my example,
and asked whether out should be set to 'in', or 'in+1'.  The answer
is of course 'in'.  The question is not meaningful as stated.  The
question should be: does it point to the ORIGINAL value of 'in', or
the incremented value of 'in'.)
	Dave Olson



More information about the Comp.lang.c mailing list