how to make a debug in c
snippet in c

how to make a debug in c

user1349

#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();
}