preproc.c 528 B

12345678910111213141516171819202122
  1. /* preproc.c -- simple preprocessor examples */
  2. #include <stdio.h>
  3. #define TWO 2 /* you can use comments if you like */
  4. #define OW "Consistency is the last refuge of the unimagina\
  5. tive. - Oscar Wilde" /* a backslash continues a definition */
  6. /* to the next line */
  7. #define FOUR TWO*TWO
  8. #define PX printf("X is %d.\n", x)
  9. #define FMT "X is %d.\n"
  10. int main(void)
  11. {
  12. int x = TWO;
  13. PX;
  14. x = FOUR;
  15. printf(FMT, x);
  16. printf("%s\n", OW);
  17. printf("TWO: OW\n");
  18. return 0;
  19. }