home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 258_01 / define.c < prev    next >
Text File  |  1988-03-30  |  512b  |  18 lines

  1.                                         /* Chapter 6 - Program 1 */
  2. #define START  0  /* Starting point of loop */
  3. #define ENDING 9  /* Ending point of loop */
  4. #define MAX(A,B)  ((A)>(B)?(A):(B))  /* Max macro definition */
  5. #define MIN(A,B)  ((A)>(B)?(B):(A))  /* Min macro definition */
  6.  
  7. main()
  8. {
  9. int index,mn,mx;
  10. int count = 5;
  11.  
  12.    for (index = START;index <= ENDING;index++) {
  13.       mx = MAX(index,count);
  14.       mn = MIN(index,count);
  15.       printf("Max is %d and min is %d\n",mx,mn);
  16.    }
  17. }
  18.