whitecap
0
Q:

how to make a debug in c

#include <stdio.h>

#define DEBUG 1 // Set to 0 for no debug

#if DEBUG // check if debug is 1

#define LOG(X) printf(X) // define log as printf

#else // if debug not 1

#DEFINE LOG(X) // define log as nothing

#endif // end



void main(void) {
  	LOG("Hello, Debug!\n");
	printf("Hello, World!\n");
  	getchar();
}
0

New to Communities?

Join the community