Chapter 16
dist = 5280 * miles; is valid.
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).
nex = = 6;; is valid, but not meaningful. Apparently the user forgot that he or she was writing for the preprocessor, not writing in C.
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.
#define NEW(X) ((X) + 5)
#define MIN(X,Y) ( (X) < (Y) ? (X) : (Y) )
#define EVEN_GT(X,Y) ( (X) > (Y) && (X) % 2 == 0 ? 1 : 0 )
#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.