38. C Pre-processor : C

C Pre-processor

C Pre-processor

The C Pre-processor isn't a piece of the compiler. The C Pre-processor is only a text replacement apparatus, and it educates the compiler to do required pre-handling before the real gathering process. We allude to the C Pre-processor as CPP. 


Pre-processor mandates like #include happen when they are seen and continue to work until the finish of the document that contains them; the program's square design is unimportant. In C, Pre-handling mandates are lines in the program that begin with the hash symbol'#.' The hash image '#' is trailed by an identifier that is the order name. 


Directive

Description

#include

This directive will insert a particular header from another file.

#define

This will substitute a pre-processor macro.

#undef

Using #undef, we can undefine a pre-processor macro.

#ifdef

It will return true if this macro is defined.

#if

It will test if a compile time condition is true.

#elif

Using #elif, we can define #else and #if in one statement

#endif

It will end pre-processor conditional

#error

Using #error, we can print the error message on stderr.

#pragma

It will issue the special commands to the compiler, using a standardized method.



Conclusion

  • The initial phase in incorporating the C program is the pre-processor, a kind of robotized proofreader that adjusts our source code before giving it to the compiler to convert into machine language code. 
  • One of the undertakings of the pre-processor is that it eliminates all remarks, which the compiler disregards. 
  • The pre-processor additionally reacts to orders in the code like #define, #include, or #elif, which give the pre-processor the guidelines on the most proficient method to alter the source code before giving it to the compiler.

Post a Comment

0 Comments