/* * var8.c - Add '#define' to top for program for preprocessor, * YEAR is a simple macro with a number. * WEIGHT is morecomplex. * This is not a variable declaration, does not allocate memory. * preprocessor instead, looks for all occurences of YEAR, and replaces with the value 1871. * preprocessor instead, looks for all occurences of WEIGHT(xx), and replaces with the equation. */ #include #define YEAR 1871 #define WEIGHT(xx) printf(" Now he weighs %d pounds.\n", xx) int main(void) { char name[]="Orin Braucher"; int month = 6; int day = 23; float birthmass = 3.9; float birthweight = 8.6; char middleinit = 'E'; printf("He was born on %d/%d/%d.\n", month, day, YEAR); printf("At birth he weighted %.2f kg or %.2f pounds.\n", birthmass, birthweight); printf("He was given %c for a midle initial.\n", middleinit); printf("%s is his name.\n", name); WEIGHT(150); WEIGHT(88); WEIGHT(YEAR); return 0; }