#define
#error
#if
#else
#elif
#endif
#ifdef
#ifndef
#undef
#line
#pragma
#define 指令
宏定义指令
#define BUFSIZE 20
#define MAX(x, y) (x>y)?x:y
注意:
1. 在宏定义语名后没有";"
2. 在Turbo C程序中习惯上用大写字符作为宏替换名, 而且常放在程序开头。
3. 宏定义还有一个特点, 就是宏替换名可以带有形式参数, 在程序中用到
时, 实际参数会代替这些形式参数。
#undef指令
宏删除指令
#undef MAX
主要用来使宏替换名只限定在需要使用它们的程序段中。
#error指令
#error error here.
该指令用于程序的调试, 当编译中遇到#error指令就停止编译。出错信息不加引号
#i nclude 指令
#i nclude 指令的作用是指示编译器将该指令所指出的另一个源文件嵌入
#i nclude指令所在的程序中, 文件应使用双引号或尖括号括起来
#i nclude <stdio.h>
#i nclude "myinformixpro.h"
一般系统库用<>引有,自定义库用""引用
程序也允许嵌入其它文件, 例如:
main()
{
#i nclude <help.c>
}
其中help.c为另一个文件, 内容可为
printf("Glad to meet you here!");
#if、#else、#endif指令
条件编择指令
#if 常数表达式
语句段;
#else
语句段;
#endif