Debugging Information with DEBUG Print in IAR

#include “stdafx.h”

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

// Whether to enable DEBUG mode

//#define _DEBUG_ 0 // Not enabled

#define _DEBUG_ 1 // Enabled

#if _DEBUG_

#define PRINTF(…) printf(__VA_ARGS__)

#else

#define PRINTF(…)

#endif

int main()

{

int a, b, c;

b = 1;

c = 2;

a = b + c;

PRINTF(“a = %d\n”, a);

getchar();

return 0;

}

Debugging Information with DEBUG Print in IAR

Leave a Comment