home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / learn / incmac.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-07  |  389 b   |  18 lines

  1. /* INCMAC.C: Increment operator in macro argument. 
  2. */
  3.  
  4. #include <stdio.h>
  5. #define ABS(value)  ( (value) >= 0 ? (value) : -(value) )
  6.  
  7. main()
  8. {
  9.    static int array[4] = {3, -20, -555, 6};
  10.    int *ptr = array;
  11.    int val, count;
  12.    for( count = 0; count < 4; count++ )
  13.    {
  14.       val = ABS(*ptr++); /* Error! */
  15.       printf( "abs of array[%d] = %d\n", count, val );
  16.    }
  17. }
  18.