code understanding help

Mathieu Segaud segaud at crans.org
Sun Apr 3 09:43:31 PDT 2005


Terry Tree <terry.tree at xxxxxxxxx> writes:

> I'm trying to go through a book on programming in C and I'm having
> problem understanding the second example in the book.
>
> $cat 2.c 
>
> #define PRINTX printf("%d\n", x);
>
> int
> main(int argc, char *argv[])
> {
>     int x = 2, y, z;
>
>     x *= 3 + 2; PRINTX;

here the output is 10, right ?

>     x *= y = z = 4; PRINTX; // the output makes no sense

so here it becomes 40.

-- 
Mathieu Segaud





More information about the Users mailing list