Answer: </I>A macro is a preprocessor directive that provides a mechanism for token replacement in your source code. Macros are created by using the #define statement. Here is an example of a macro: Macros can also utilize special operators such as the <I>stringizing </I>operator (#) and the <I>concatenation </I>operator (##).The stringizing operator can be used to convert macro parameters to quoted strings, as in the following example: #define DEBUG_VALUE(v) printf(#v " is equal to %d.n", v) In your program, you can check the value of a variable by invoking the DEBUG_VALUE macro: ... int x = 20; DEBUG_VALUE(x); ... The preceding code prints "x is equal to 20." on-screen. This example shows that the stringizing operator used with macros can be a very handy debugging tool.
Tags:Interview Questions, Languages, C,
Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.
Sponsor Advertisement
Real Estate Management System Software
Real Estate Management Software is an advanced end-to-end Real Estate Office Management System that enables Real Estate Agencies to manage more effectively, search prorty details, keep property owner data etc. Web-based tracking and accounting solution ideal for commercial, residential housing....
No comments:
Post a Comment