ifdef.c 371 B

123456789101112131415161718192021
  1. /* ifdef.c -- uses conditional compilation */
  2. #include <stdio.h>
  3. #define JUST_CHECKING
  4. #define LIMIT 4
  5. int main(void)
  6. {
  7. int i;
  8. int total = 0;
  9. for (i = 1; i <= LIMIT; i++)
  10. {
  11. total += 2*i*i + 1;
  12. #ifdef JUST_CHECKING
  13. printf("i=%d, running total = %d\n", i, total);
  14. #endif
  15. }
  16. printf("Grand total = %d\n", total);
  17. return 0;
  18. }