Chapter 16

    1. dist = 5280 * miles; is valid.

    2. plort = 4 * 4 + 4; is valid. But if the user really wanted 4 * (4 + 4), he or she should have used #define POD (FEET + FEET).

    3. nex = = 6;; is valid, but not meaningful. Apparently the user forgot that he or she was writing for the preprocessor, not writing in C.

    4. y = y + 5; is valid. berg = berg + 5 * lob; is valid, but this is probably not the desired result. est = berg + 5/ y + 5; is valid, but this is probably not the desired result. nilp = lob *-berg + 5; is valid, but this is probably not the desired result.

  1. #define NEW(X) ((X) + 5)

  2. #define MIN(X,Y) ( (X) < (Y) ? (X) : (Y) )

  3. #define EVEN_GT(X,Y) ( (X) > (Y) && (X) % 2 == 0 ? 1 : 0 )

  4. #define PR(X,Y) printf(#X " is %d and " #Y " is %d\n", X,Y)

    Because X and ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.