#ifdef 标识符
程序段1
#else
程序段2
#endif
#include <stdio.h>
#define __DEBUG__
int main()
{
#ifdef __DEBUG__
printf("hello world\n");
#else
printf("hello c world\n");
#endif
return 0;
}
beyes@linux-beyes:~/C> ./conditioncompile.exe
hello c world
#ifndef 标识符
程序段1
#else
程序段2
#endif
#if 常量表达式
程序段1
#else
程序段2
#endif
#include <stdio.h>
#define R 1
int main()
{
#if R
printf("hello world\n");
#else
printf("hello c world\n");
#endif
return 0;
}
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |