Friday, March 5, 2010

50

#ifdef NULL
#define NULL 2
#endif
#ifndef NULL
#define NULL 4
#end if
int main()
{
printf("%d",++NULL^NULL|0);
return 0;
}

Output:


Compilation Error

Logic:
we can't modify constant variables. all variables defined in the define are constants.
click hereto know about the #define macro.
#ifdef macro is like the if control statment. #ifdef checks the constant is defined before.if so it'll execute the loop.
#ifndef macro checks the constant is not defined before. if so it'll execute the loop.

0 comments:

Post a Comment