Thursday, December 3, 2009

Using define without assigning value

#include
#define NO
#define YES

int main()
{
    int i = 5,j;
    if (i>5)   j=YES;
    else j=NO;

    printf("%d",j);
}

Output: Expression syntax in function main
Explanation:  Because when assigning j with YES or NO we don't know what is the value of YES or NO.

0 comments:

Post a Comment