home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / unary.c < prev   
C/C++ Source or Header  |  1993-10-16  |  507b  |  24 lines

  1.    /* Demonstrates unary operator prefix and postfix modes */
  2.  
  3.    #include <stdio.h>
  4.  
  5.    int a, b;
  6.  
  7.    main()
  8.    {
  9.        /* Set a and b both equal to 5 */
  10.  
  11.       a = b = 5;
  12.  
  13.       /* Print them, decrementing each time. */
  14.       /* Use prefix mode for b, postfix mode for a */
  15.  
  16.       printf("\n%d   %d", a--, --b);
  17.       printf("\n%d   %d", a--, --b);
  18.       printf("\n%d   %d", a--, --b);
  19.       printf("\n%d   %d", a--, --b);
  20.       printf("\n%d   %d", a--, --b);
  21.  
  22.       return 0;
  23.   }
  24.