Uses conditional compilation - C Preprocessor

C examples for Preprocessor:Preprocessor Operators

Description

Uses conditional compilation

Demo Code

#include <stdio.h>
#define JUST_CHECKING// w  ww. j ava 2 s .com
#define LIMIT 4

int main(void)
{
    int i;
    int total = 0;

    for (i = 1; i <= LIMIT; i++)
    {
        total += 2*i*i + 1;
#ifdef JUST_CHECKING
        printf("i=%d, running total = %d\n", i, total);
#endif
    }
    printf("Grand total = %d\n", total);
    
    return 0;
}

Result


Related Tutorials