(Not logged on) | Register | Log On

You can subscribe to this discussion group using an RSS feed reader. techInterview Discussion

Answers to technical interview questions. A part of TechInterview.org

A part of techInterview.org: answers to technical interview questions.

Your host: Michael Pryor

Can we call a macro from within a macro

#define AND &&
#define ARRANGE (a>25 AND a<50)
main()
{int a = 30;
if (ARRANGE)
printf("within range");
else
printf("out of range");
}

What is the output.
Rajesh Send private email
Wednesday, August 02, 2006
 
 
yes
V Send private email
Wednesday, August 02, 2006
 
 
you probably want to code it like this:

#define ARRANGE(val,low,high) ((val)>(low) AND (val)<(high))
C Guy
Wednesday, August 02, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz