C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C #ifndefThe #ifndef preprocessor directive checks if macro is not defined by #define. If yes, it executes the code otherwise #else code is executed, if present. Syntax: #ifndef MACRO //code #endif Syntax with #else: #ifndef MACRO //successful code #else //else code #endif C #ifndef exampleLet's see a simple example to use #ifndef preprocessor directive. #include Output: Enter a:5 Value of a: 5 But, if you don't define INPUT, it will execute the code of #ifndef. #include Output: Value of a: 2
Next TopicC #if
|