Preprocessors
Two Important Aspects of Preprocessor
- Preprocessor Directives - Macros
#ifdef #ifndef #else #endif
- These directives are used for conditional compilation - This directives allows certain code blocks to be included or excluded based on conditions
Preprocessor Directives
- begin with a # symbol - typically placed at the beginning of a line
Preprocessor
- modifies the sources code before compiled - provide instructions to the compiler
Preprocessor Directives
- special instruction that guide the preprocessor in modifying the source code
Macros
- symbolic names representing a constant value or code snippet - can simplify complex code, improve code readability, and allow for easy code modifications.
#include
- this directive is used to add external files or libraries into the source code - allows you to reuse code from other files
#define
- this directive is used to create macros
#pragma
- this directive is used to proved additional instructions to the compiler - compiler-specific - controls optimization settings, disable warnings, or include specific headers
#define MACRO_NAME value
Syntax for defining macro
#include <header_file>
Syntax of #include