Comma Operator

Chris Torek chris at mimsy.UUCP
Sun Jan 15 00:04:16 AEST 1989


In article <922 at quintus.UUCP> nair at quintus writes:
>What should this print?
>
>	int x, y;
>	printf("%d %d\n", (x = 1, y = 2), x, y);

(presumably there is one `%d' missing here.)

Nothing certain.  The invocation contains two commas and *one* comma
operator.  The order of evaluation of the one comma operator is guaranteed,
but the order of the whole mess is not.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list