How to use #ifdef to C/C++

example
int testfunc(int x, int y)
{
#ifdef  _DEBUG
      printf("x=%d, Y=%d", x,y);  // if x=1, y =2 
#endif
   return  (x * Y) ;
}

if debug mode
#define _DEBUG "DEBUG"

print x=1, Y=2
after return


if release mode,
not print
return

No comments:

Post a Comment

Apartment Buying Guide 2025: Shocking Red Flags You Should NEVER Ignore!

 🏙️ Apartment Buying Guide 2025: Shocking Red Flags You Should NEVER Ignore! 🚨 Are you thinking about buying an apartment in 2025? 🏢  It’...