Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
| 1. | Locate the system header files limits.h and float.h on your machine. Examine the files to see what’s in them. If these files include other header files, be sure to track them down as well, to examine their contents. |
| 2. | Define a macro called MIN that gives the minimum of two values. Then write a program to test the macro definition. |
| 3. | Define a macro called MAX3 that gives the maximum of three values. Write a program to test the definition. |
| 4. | Write a macro called IS_UPPER_CASE that gives a nonzero value if a character is an uppercase letter. |
| 5. | Write a macro called IS_ALPHABETIC that gives a nonzero value if a character is an alphabetic character. Have the macro use the IS_LOWER_CASE macro defined in the chapter text and the IS_UPPER_CASE macro defined in Exercise 4. |
| 6. | Write a macro called IS_DIGIT that gives a nonzero value if a character is a digit 0 through 9. Use this macro in the definition of another macro called IS_SPECIAL, which gives a nonzero result if a character is a special character (that is, not alphabetic and not a digit). Be sure to use the IS_ALPHABETIC macro developed in Exercise 5. |
| 7. | Write a macro called ABSOLUTE_VALUE that computes the absolute value of its argument. Make sure that the macro properly evaluates an expression such as this:
ABSOLUTE_VALUE (x + delta) |