C - How to use #ifdef with an OR condition? Code Example

The code for How to use #ifdef with an OR condition?

#include <stdio.h>

#define DEFAULT
#define XYZ
#define PQR

int main() {
#if defined(DEFAULT) || defined(XYZ)
  printf("True - 1\n");
#endif

#if defined(PQR) || defined(HELLO)
  printf("True - 2\n");
#endif

  return 0;
}

/*
Output:
True - 1
True - 2
*/
Code by IncludeHelp, on August 11, 2022 20:32

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.