条件预处理问题
linux下写的,用GCC调试出了问题,求各位大神给个解释
linux c
#include <stdio.h>
#define Max(x, y) (x > y ? x:y)
int main(void)
{
int c = 0;
#if c==0 //如果换成 #if c 输出结果就没有,这个不应该是判断是否定义变量c的吗??求解判断是否定义变量c的表达式
printf("%d\n ", Max(2, 4));
#endif
return 0;
}
#include <stdio.h>
#define Max(x, y) (x > y ? x:y)
int main(void)
{
#ifndef DEF_C
#define DEF_C
int c = 0; //把c的定义用保护宏保护起来
#endif
#ifdef DEF_C
printf("%d\n ", Max(2, 4));
#endif
return 0;
}