CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
How do you override a defined macro?
Category C Interview Questions
Rating (4.1) By 19 users
Added on 10/22/2004
Views 9179
Rate it!
Answers:

You can use the #undef preprocessor directive to undefine (override) a previously defined macro.



we can redefine it with the same name and a new value.



 Posted by: rishabh    

Contact rishabh  Contact rishabh

Assume 'NULL' is framework defined MACRO. If you wish to override, then,

#ifdef NULL
#undef NULL
#define NULL ((void*)0)
#endif

Above will override already defined MACRO in the scope.



 Posted by: Ravi A Joshi    

Contact Ravi A Joshi  Contact Ravi A Joshi

An elegant way of doing this is shown below:

#ifdef MACRO
#undef MACRO
#endif

#define MACRO X



 Posted by: Nileshkumar    

Contact Nileshkumar  Contact Nileshkumar

c is a middle level language that come in category of structural programming language so there is no concept of overriding.one method to do this is to #undef the defined macro and then give new definition to macro.



 Posted by: kirti    

Contact kirti  Contact kirti

use the #undef preprocessor directive to undefine the define Macros.



 Posted by: Joji Joseph    

Contact Joji Joseph  Contact Joji Joseph


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
How can you check to see whether a symbol is defined?
View Answer
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
View Answer
How can I convert a number to a string?
View Answer
How can I convert a string to a number?
View Answer
How do you print only part of a string?
View Answer
What is indirection?
View Answer
How many levels of pointers can you have?
View Answer
What is a null pointer?
View Answer
What is a void pointer?
View Answer
Is NULL always defined as 0?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/1017/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.72