How can you check to see whether a symbol is defined? Ans. You can use the #ifdef and #ifndef preprocessor directives to check whether a symbol has been defined (#ifdef) or whether it has not been defined (#ifndef). Many programmers like to ensure that their own version of NULL is defined, not someone else's. This task can be accomplished as shown here: #ifdef NULL #undef NULL #endif #define NULL (void*) 0 The first line, #ifdef NULL, checks to see whether the NULL symbol has been defined. If so, it is undefined using #undef NULL and the new definition of NULL is defined. To check whether a symbol has not been defined yet, you would use the #ifndef preprocessor directive. - Study24x7
Social learning Network
28 Mar 2023 10:45 AM study24x7 study24x7

How can you check to see whether a symbol is defined? Ans. You can use the #ifdef and #ifndef preprocessor directives to c...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles