#include "stdio.h"
//#define WINDOWS 3 //执行条件
#ifndef WINDOWS
#define type 2
#else
#define type 5
#endif
int main()
{
int i=type;
int y=0;
printf("%d/n",i);
scanf("%d/n",y);//
//system("pause");
return 0;
}
本文展示了一个使用C语言预处理指令宏定义的例子,通过不同的宏定义实现变量类型的动态选择,并在主函数中打印出相应的类型值。
#include "stdio.h"
//#define WINDOWS 3 //执行条件
#ifndef WINDOWS
#define type 2
#else
#define type 5
#endif
int main()
{
int i=type;
int y=0;
printf("%d/n",i);
scanf("%d/n",y);//
//system("pause");
return 0;
}
8992
1万+
513
2232

被折叠的 条评论
为什么被折叠?