*p++ = *p results?

Stanley Friesen friesen at psivax.UUCP
Tue Mar 25 02:22:54 AEST 1986


In article <312 at imagen.UUCP> kevin at imagen.UUCP (Kevin L. Malloy) writes:
>In the statement *p++ = *p; what will be the result?  Will p be equal
>to itself or will p be equal to the next value it is pointing to?
>In other words should p be incremented after it is evaluated or should
>p be incremented after the assignment operation is finished?-- 
>---
	The answer is - either. They are both "correct" since timing
of side-effects like assignment and post-increment is implementation
defined i "C". Do not ever write code like this!
-- 

				Sarima (Stanley Friesen)

UUCP: {ttidca|ihnp4|sdcrdcf|quad1|nrcvax|bellcore|logico}!psivax!friesen
ARPA: ttidca!psivax!friesen at rand-unix.arpa



More information about the Comp.lang.c mailing list