c语言中#ifdef和#ifndef的比较

阅读C代码的时候会发现在有些地方会使用#ifdef有的地方会使用#ifndef,如何区分这两个。

#ifdef表示“if the following is defined”;#ifndef表示“if the following is not defined”。

根据上面的描述可以推断下面代码会输出:”one is defined “

1
2
3
4
5
6
7

#ifdef one
printf("one is defined ");
#endif
#ifndef one
printf("one is not defined ");
#endif