C languageC SolutionChapter 8Programming

Q5 What is Miscellaneous Directives. Types of miscellaneous directives (#undef and #pragma)?

Program: 149

These two pre-processor directives are not commonly used pre-processors.

#undef

It is used to convert a defined macro name to undefined.

For example: # undef PENTIUM

Output:

 Main function

#pragma

We use it for assigning execution order to functions. It can run a function before main and before termination of program.

For example:

# pragma startup fun1

#pragma exit fun2

Output:

 
 ABC Function
 Main Function
 XYZ Function

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.