- #include
eg: #define TRUE 1
- #undef
eg: #undef TRUE
#define TRUE correct
#include
Angle brackets Searches in the default directories of include files.
Quotes specifies search in current directory.
- #ifdef
e.g: #ifdef TRUE
#define FALSE 0
#endif
Note: we can easily add multiple macros in between the two macros.
- #ifndef
#define WRONG 0
- #if
- #error
#if !define FALSE
#error "Specify FALSE condition"
- #line
eg: #line100 indicates it is in line 100
C has provided two special identifiers: __FILE__ and __LINE__, which indicate the file name of the source file and the current line number, respectively.
Macros allow replacement of the identifier by using a statement or expression.
eg: #define CUBE(x) x*x*x
No comments:
Post a Comment