#define and #include
Preprocessor Directives
#include -
- This mandate makes the pre-processor bring the substance of one more document into the source code. It will add the substance at where the #include order is found.
- This order is regularly used to incorporate the C header documents for the C capacities that are held outside of the current source record.
- A header record is a document that contains the expansion ".h". This expansion has C full-scale definitions and C capacity announcements to be divided among a few source records.
- Documents that the software engineer composes
- Documents that accompany the compiler.
- We solicitation to utilize a header document in our program by incorporating it with the C preprocessing mandate #include, as we have seen the stdio.h header record, which shows up with the compiler.
- The #include <headerfile> advises the compiler to search for the catalog where framework header documents are held.
- The #include "header document" advises the compiler to examine the current index from where the program is running.
Note - If a header record is incorporated inside the image <>, the pre-processor will look through a foreordained index way to find the header document. If the header document is encased in quotes" ", the pre-processor will search for the header record in a similar index as the source record.
#define -
- This order is utilized to characterize pre-processor variables, consistent or full scale. The full scale works similarly as capacities. The #define can utilize any fundamental information type.
- This pre-processor mandate can be utilized to supplant a word with a number worldwide. Maybe a proofreader did a worldwide hunt and supplant alter of the record.
- We can utilize the #define an order for investigating purposes. We can have print explanations that will be just dynamic while troubleshooting.
- #define constant_name (expression) OR #define constant_name value
- Constant_name - The name of the steady.
- Value - The worth of the steady.
- Expression - It is an articulation whose worth is allocated to the steady. The articulation should be encased in enclosures if it contains any administrators.
#undef -
- It is utilized to undefine a large scale to dispense with its definition.
#ifdef -
- It is utilized to check whether or not a large scale is characterized. If it is characterized, it executes the code.
#if -
- It checks whether or not the given condition is valid. Assuming valid, then, at that point, it executes the code.
#else -
- If the state of in case is false, the else is executed.
#elif -
- It is utilized to embed more conditions among if and else. If the in-case articulation is valid, elif won't be checked.
#pragma - It is utilized to give some unique orders to the compiler.
- __DATE__ - It prints the current date onto the screen. The date design it follows is MMMDDYYY.
- __TIME__ - It prints the current time onto the screen. The date design it follows is HH: MM: SS.
- __FILE__ - It prints the current document name onto the screen. The name will be printed as a string exacting.
- __LINE__ - It prints the current line number onto the screen. The number will be printed as a decimal steady. It is utilized to check whether or not our program is being compiler utilizing ANSI standard. It will return 1 assuming valid.
0 Comments