home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day04
/
unary.c
< prev
Wrap
C/C++ Source or Header
|
2002-04-07
|
514b
|
26 lines
/* Demonstrates unary operator prefix and postfix modes */
#include <stdio.h>
int a, b;
int main(void)
{
/* Set a and b both equal to 5 */
a = b = 5;
/* Print them, decrementing each time. */
/* Use prefix mode for b, postfix mode for a */
printf("\nPost Pre");
printf("\n%d %d", a--, --b);
printf("\n%d %d", a--, --b);
printf("\n%d %d", a--, --b);
printf("\n%d %d", a--, --b);
printf("\n%d %d\n", a--, --b);
return 0;
}