Use #define Statement to create two constants - C Preprocessor

C examples for Preprocessor:Preprocessor Operators

Description

Use #define Statement to create two constants

Demo Code

#include <stdio.h>

#define YES     1//w ww.jav a  2  s .  c o  m
#define NO      0

int isEven (int number){
    int answer;

    if ( number % 2 == 0 )
        answer = YES;
    else
        answer = NO;

    return answer;
}

int main (void)
{
    int isEven (int number);

    if ( isEven (17) == YES )
        printf ("yes ");
    else
        printf ("no ");

    return 0;
}

Result


Related Tutorials