> N = 1;
> A[N++] = N++;
On Thu, 31 May 2007, Cameron Kaiser wrote:
I'd expect that to evaluate to a[1]=2 and n winds
up being 3. But I'm weird.
a very reasonable possibility
But, it assumes that the evaluation and increment of N in the lvalue occur
before the evaluation and increment of the right side of the assignment.
You can't count on all pre-ansi C compilers doing it that order.
K&R include at least one similar example, of what not to do.
--
Grumpy Ol' Fred cisin at
xenosoft.com