Preprocessor Directives
The preprocessor directives are used to provide instructions to the preprocessor that expands the code before compilation. They start with the # symbol.
The following table lists all the preprocessor directives in C/C++:
S.No. | Preprocessor Directives |
Description |
---|---|---|
1. |
#define |
Used to define a macro |
2. |
#undef |
Used to undefine a macro |
3. |
#include |
Used to include a file in the source code program |
4. |
#ifdef |
Used to include a section of code if a certain macro is defined by #define |
5. |
#endif |
Used to mark the end of #endif |
6. |
#ifndef |
Used to include a section of code if a certain macro is not defined by #define |
7. |
#if |
Check for the specified condition |
8. |
#else |
Alternate code that executes when #if fails |
9. |
#pragma |
This directive is a special purpose directive and is used to turn on or off some features. |
C Cheat Sheet
This C Cheat Sheet provides an overview of both basic and advanced concepts of the C language. Whether you’re a beginner or an experienced programmer, this cheat sheet will help you revise and quickly go through the core principles of the C language.
In this Cheat Sheet, we will delve into the basics of the C language, exploring its fundamental concepts that lay the groundwork for programming. We will cover topics such as variables, data types, and operators, providing you with a solid understanding of the building blocks of C programming.
Contact Us