文档库 最新最全的文档下载
当前位置:文档库 › C所有头文件及作用

C所有头文件及作用

C所有头文件及作用
C所有头文件及作用

首页人才招聘项目交易 BLOG 兴趣小组图书资讯文章下载源码网友作品刻盘服务

您所在位置:论坛首页— C语言中的所有头文件,请问在哪里可以找到??打印本页保存页面

C语言中的所有头文件,请问在哪里可以找到??

我刚毕业不久,想知道C中的各种头文件的定义和应用;谢谢各位大侠!!!

回复人:59030777 回复时间:2005-4-28 15:12:00

C、传统 C++

#include //设定插入点

#include //字符处理

#include //定义错误码

#include //浮点数处理

#include //文件输入/输出

#include //参数化输入/输出

#include //数据流输入/输出

#include //定义各种数据类型最值常量

#include //定义本地化函数

#include //定义数学函数

#include //定义输入/输出函数

#include //定义杂项函数及内存分配函数

#include //字符串处理

#include //基于数组的输入/输出

#include //定义关于时间的函数

#include //宽字符处理及输入/输出

#include //宽字符分类

//////////////////////////////////////////////////////////////////////////

标准 C++ (同上的不再注释)

#include //STL 通用算法

#include //STL 位集容器

#include

#include

#include

#include

#include //复数类

#include

#include

#include

#include

#include //STL 双端队列容器

#include //异常处理类

#include

#include //STL 定义运算函数(代替运算符)

#include

#include //STL 线性列表容器

#include //STL 映射容器

#include

#include //基本输入/输出支持

#include //输入/输出系统使用的前置声明

#include

#include //基本输入流

#include //基本输出流

#include //STL 队列容器

#include //STL 集合容器

#include //基于字符串的流

#include //STL 堆栈容器

#include //标准异常类

#include //底层输入/输出支持

#include //字符串类

#include //STL 通用模板类

#include //STL 动态数组容器

#include

#include

using namespace std;

////////////////////////////////////////////////////////////////////////// C99 增加

#include //复数处理

#include //浮点环境

#include //整数格式转换

#include //布尔环境

#include //整型环境

#include //通用类型数学宏

回复人:59030777 回复时间:2005-4-28 15:25:00

C语言库函数(A类字母)

函数名: abort

功能: 异常终止一个进程

用法: void abort(void);

程序例:

#include

#include

int main(void)

{

printf("Calling abort()\n");

abort();

return 0; /* This is never reached */

}

函数名: abs

功能: 求整数的绝对值

用法: int abs(int i);

程序例:

#include

#include

int main(void)

{

int number = -1234;

printf("number: %d absolute value: %d\n", number, abs(number)); return 0;

}

函数名: absread, abswirte

功能: 绝对磁盘扇区读、写数据

用法: int absread(int drive, int nsects, int sectno, void *buffer); int abswrite(int drive, int nsects, in tsectno, void *buffer);

程序例:

/* absread example */

#include

#include

#include

#include

int main(void)

{

int i, strt, ch_out, sector;

char buf[512];

printf("Insert a diskette into drive A and press any key\n"); getch();

sector = 0;

if (absread(0, 1, sector, &buf) != 0)

{

perror("Disk problem");

exit(1);

}

printf("Read OK\n");

strt = 3;

for (i=0; i<80; i++)

{

ch_out = buf[strt+i];

putchar(ch_out);

}

printf("\n");

return(0);

}

函数名: access

功能: 确定文件的访问权限

用法: int access(const char *filename, int amode);

程序例:

#include

#include

int file_exists(char *filename);

int main(void)

{

printf("Does NOTEXIST.FIL exist: %s\n",

file_exists("NOTEXISTS.FIL") ? "YES" : "NO");

return 0;

}

int file_exists(char *filename)

{

return (access(filename, 0) == 0);

}

函数名: acos

功能: 反余弦函数

用法: double acos(double x);

程序例:

#include

#include

int main(void)

{

double result;

double x = 0.5;

result = acos(x);

printf("The arc cosine of %lf is %lf\n", x, result); return 0;

}

函数名: allocmem

功能: 分配DOS存储段

用法: int allocmem(unsigned size, unsigned *seg); 程序例:

#include

#include

#include

int main(void)

{

unsigned int size, segp;

int stat;

size = 64; /* (64 x 16) = 1024 bytes */

stat = allocmem(size, &segp);

if (stat == -1)

printf("Allocated memory at segment: %x\n", segp);

else

printf("Failed: maximum number of paragraphs available is %u\n",

stat);

return 0;

}

函数名: arc

功能: 画一弧线

用法: void far arc(int x, int y, int stangle, int endangle, int radius); 程序例:

#include

#include

#include

#include

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int midx, midy;

int stangle = 45, endangle = 135;

int radius = 100;

/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "");

/* read result of initialization */

errorcode = graphresult(); /* an error occurred */

if (errorcode != grOk)

{

printf("Graphics error: %s\n", grapherrormsg(errorcode));

printf("Press any key to halt:");

getch();

exit(1); /* terminate with an error code */

}

midx = getmaxx() / 2;

midy = getmaxy() / 2;

setcolor(getmaxcolor());

/* draw arc */

arc(midx, midy, stangle, endangle, radius);

/* clean up */

getch();

closegraph();

return 0;

}

函数名: asctime

功能: 转换日期和时间为ASCII码

用法: char *asctime(const struct tm *tblock);

程序例:

#include

#include

#include

int main(void)

{

struct tm t;

char str[80];

/* sample loading of tm structure */

t.tm_sec = 1; /* Seconds */

t.tm_min = 30; /* Minutes */

t.tm_hour = 9; /* Hour */

t.tm_mday = 22; /* Day of the Month */

t.tm_mon = 11; /* Month */

t.tm_year = 56; /* Year - does not include century */

t.tm_wday = 4; /* Day of the week */

t.tm_yday = 0; /* Does not show in asctime */

t.tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */

/* converts structure to null terminated

string */

strcpy(str, asctime(&t));

printf("%s\n", str);

return 0;

}

函数名: asin

功能: 反正弦函数

用法: double asin(double x);

程序例:

#include

#include

int main(void)

{

double result;

double x = 0.5;

result = asin(x);

printf("The arc sin of %lf is %lf\n", x, result); return(0);

}

函数名: assert

功能: 测试一个条件并可能使程序终止

用法: void assert(int test);

程序例:

#include

#include

#include

struct ITEM {

int key;

int value;

};

/* add item to list, make sure list is not null */ void additem(struct ITEM *itemptr) {

assert(itemptr != NULL);

/* add item to list */

}

int main(void)

additem(NULL);

return 0;

}

函数名: atan

功能: 反正切函数

用法: double atan(double x);

程序例:

#include

#include

int main(void)

{

double result;

double x = 0.5;

result = atan(x);

printf("The arc tangent of %lf is %lf\n", x, result);

return(0);

}

函数名: atan2

功能: 计算Y/X的反正切值

用法: double atan2(double y, double x);

程序例:

#include

#include

int main(void)

{

double result;

double x = 90.0, y = 45.0;

result = atan2(y, x);

printf("The arc tangent ratio of %lf is %lf\n", (y / x), result); return 0;

}

函数名: atexit

功能: 注册终止函数

用法: int atexit(atexit_t func);

程序例:

#include

#include

void exit_fn1(void)

{

printf("Exit function #1 called\n"); }

void exit_fn2(void)

{

printf("Exit function #2 called\n"); }

int main(void)

{

/* post exit function #1 */

atexit(exit_fn1);

/* post exit function #2 */

atexit(exit_fn2);

return 0;

}

函数名: atof

功能: 把字符串转换成浮点数

用法: double atof(const char *nptr); 程序例:

#include

#include

int main(void)

{

float f;

char *str = "12345.67";

f = atof(str);

printf("string = %s float = %f\n", str, f); return 0;

}

函数名: atoi

功能: 把字符串转换成长整型数

用法: int atoi(const char *nptr);

程序例:

#include

#include

int main(void)

{

int n;

char *str = "12345.67";

n = atoi(str);

printf("string = %s integer = %d\n", str, n); return 0;

}

函数名: atol

功能: 把字符串转换成长整型数

用法: long atol(const char *nptr);

程序例:

#include

#include

int main(void)

{

long l;

char *str = "98765432";

l = atol(lstr);

printf("string = %s integer = %ld\n", str, l); return(0);

}

楼主是要这种东西吗!!

回复人:yuer438 回复时间:2005-4-28 21:10:00

非常感谢大侠!!!!小弟真的是感激不尽!!!希望以后有什么困难大侠还能鼎力相助!!谢谢!

回复人:yuer438 回复时间:2005-4-28 21:13:00

是的,我刚刚学C语言,想知道这些是什么东西,怎么用的!真是太感激你们了!

回复人:59030777 回复时间:2005-4-29 16:43:00

楼主还要吗这只是 a字头的!!要是要联系我!

回复人:59030777 回复时间:2005-4-29 16:47:00

在贴个b字头的

函数名: bar

功能: 画一个二维条形图

用法: void far bar(int left, int top, int right, int bottom);

程序例:

#include

#include

#include

#include

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int midx, midy, i;

/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "");

/* read result of initialization */

errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */

{

printf("Graphics error: %s\n", grapherrormsg(errorcode));

printf("Press any key to halt:");

getch();

exit(1); /* terminate with an error code */

}

midx = getmaxx() / 2;

midy = getmaxy() / 2;

/* loop through the fill patterns */

for (i=SOLID_FILL; i

{

/* set the fill style */

setfillstyle(i, getmaxcolor());

/* draw the bar */

bar(midx-50, midy-50, midx+50,

midy+50);

getch();

}

/* clean up */

closegraph();

return 0;

}

函数名: bar3d

功能: 画一个三维条形图

用法: void far bar3d(int left, int top, int right, int bottom, int depth, int topflag);

程序例:

#include

#include

#include

#include

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int midx, midy, i;

/* initialize graphics, local variables */

initgraph(&gdriver, &gmode, "");

/* read result of initialization */

errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */

{

printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:");

getch();

exit(1); /* terminate with error code */

}

midx = getmaxx() / 2;

midy = getmaxy() / 2;

/* loop through the fill patterns */

for (i=EMPTY_FILL; i

{

/* set the fill style */

setfillstyle(i, getmaxcolor());

/* draw the 3-d bar */

bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1);

getch();

}

/* clean up */

closegraph();

return 0;

}

函数名: bdos

功能: DOS系统调用

用法: int bdos(int dosfun, unsigned dosdx, unsigned dosal); 程序例:

#include

#include

/* Get current drive as 'A', 'B', ... */

char current_drive(void)

{

char curdrive;

/* Get current disk as 0, 1, ... */

curdrive = bdos(0x19, 0, 0);

return('A' + curdrive);

}

int main(void)

{

printf("The current drive is %c:\n", current_drive());

return 0;

}

函数名: bdosptr

功能: DOS系统调用

用法: int bdosptr(int dosfun, void *argument, unsigned dosal); 程序例:

#include

#include

#include

#include

#include

#include

#define BUFLEN 80

int main(void)

{

char buffer[BUFLEN];

int test;

printf("Enter full pathname of a directory\n");

gets(buffer);

test = bdosptr(0x3B,buffer,0);

if(test)

{

printf("DOS error message: %d\n", errno);

/* See errno.h for error listings */

exit (1);

}

getcwd(buffer, BUFLEN);

printf("The current directory is: %s\n", buffer);

return 0;

}

函数名: bioscom

功能: 串行I/O通信

用法: int bioscom(int cmd, char abyte, int port); 程序例:

#include

#include

#define COM1 0

#define DATA_READY 0x100

#define TRUE 1

#define FALSE 0

#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)

int main(void)

{

int in, out, status, DONE = FALSE;

bioscom(0, SETTINGS, COM1);

cprintf("... BIOSCOM [ESC] to exit ...\n");

while (!DONE)

{

status = bioscom(3, 0, COM1);

if (status & DATA_READY)

if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)

putch(out);

if (kbhit())

{

if ((in = getch()) == '\x1B')

DONE = TRUE;

bioscom(1, in, COM1);

}

}

return 0;

}

函数名: biosdisk

功能: 软硬盘I/O

用法: int biosdisk(int cmd, int drive, int head, int track, int sector int nsects, void *buffer);

程序例:

#include

#include

int main(void)

{

int result;

char buffer[512];

printf("Testing to see if drive a: is ready\n");

result = biosdisk(4,0,0,0,0,1,buffer);

result &= 0x02;

(result) ? (printf("Drive A: Ready\n")) :

(printf("Drive A: Not Ready\n"));

return 0;

}

函数名: biosequip

功能: 检查设备

用法: int biosequip(void);

程序例:

#include

#include

int main(void)

{

int result;

char buffer[512];

printf("Testing to see if drive a: is ready\n");

result = biosdisk(4,0,0,0,0,1,buffer);

result &= 0x02;

(result) ? (printf("Drive A: Ready\n")) :

(printf("Drive A: Not Ready\n"));

return 0;

}

函数名: bioskey

功能: 直接使用BIOS服务的键盘接口

用法: int bioskey(int cmd);

程序例:

#include

#include

#include

#define RIGHT 0x01

#define LEFT 0x02

#define CTRL 0x04

#define ALT 0x08

int main(void)

{

int key, modifiers;

/* function 1 returns 0 until a key is pressed */

while (bioskey(1) == 0);

/* function 0 returns the key that is waiting */

key = bioskey(0);

/* use function 2 to determine if shift keys were used */ modifiers = bioskey(2);

if (modifiers)

{

printf("[");

if (modifiers & RIGHT) printf("RIGHT");

if (modifiers & LEFT) printf("LEFT");

if (modifiers & CTRL) printf("CTRL");

if (modifiers & ALT) printf("ALT");

printf("]");

}

/* print out the character read */

if (isalnum(key & 0xFF))

printf("'%c'\n", key);

else

printf("%#02x\n", key);

return 0;

}

函数名: biosmemory

功能: 返回存储块大小

用法:int biosmemory(void);

程序例:

#include

#include

int main(void)

{

int memory_size;

memory_size = biosmemory(); /* returns value up to 640K */ printf("RAM size = %dK\n",memory_size);

return 0;

}

函数名: biosprint

功能: 直接使用BIOS服务的打印机I/O

用法: int biosprint(int cmd, int byte, int port);

程序例:

#include

#include

#include

int main(void)

{

#define STATUS 2 /* printer status command */

#define PORTNUM 0 /* port number for LPT1 */

int status, abyte=0;

printf("Please turn off your printer. Press any key to continue\n"); getch();

status = biosprint(STATUS, abyte, PORTNUM);

if (status & 0x01)

printf("Device time out.\n");

if (status & 0x08)

printf("I/O error.\n");

if (status & 0x10)

printf("Selected.\n");

if (status & 0x20)

printf("Out of paper.\n");

if (status & 0x40)

printf("Acknowledge.\n");

if (status & 0x80)

printf("Not busy.\n");

return 0;

}

函数名: biostime

功能: 读取或设置BIOS时间

用法: long biostime(int cmd, long newtime);

程序例:

#include

#include

#include

#include

int main(void)

{

long bios_time;

clrscr();

C语言编程常用头文件

C语言编程常用头文件 C语言常用头文件总结 序号库类别头文件 1 字符处理ctype.h 2 地区化local.h 3 数学函数math.h 4 信号处理signal.h 5 输入输出stdio.h 6 实用工具程序stdlib.h 7 字符串处理string.h 字符处理函数 本类别函数用于对单个字符进行处理,包括字符的类别测试和字符的大小写转换头文件ctype.h 函数列表<> 函数类别函数用途详细说明 字符测试是否字母和数字isalnum 是否字母isalpha 是否控制字符iscntrl 是否数字isdigit 是否可显示字符(除空格外)isgraph 是否可显示字符(包括空格)isprint 是否既不是空格,又不是字母和数字的可显示字符ispunct 是否空格isspace 是否大写字母isupper 是否16进制数字(0-9,A-F)字符isxdigit 字符大小写转换函数转换为大写字母toupper 转换为小写字母tolower 地区化 本类别的函数用于处理不同国家的语言差异。

头文件local.h 函数列表 函数类别函数用途详细说明 地区控制地区设置setlocale 数字格式约定查询国家的货币、日期、时间等的格式转换localeconv 数学函数 本分类给出了各种数学计算函数,必须提醒的是ANSI C标准中的数据格式并不符合IEEE754标准,一些C语言编译器却遵循IEEE754(例如frinklin C51) 头文件math.h 函数列表 函数类别函数用途详细说明 错误条件处理定义域错误(函数的输入参数值不在规定的范围内) 值域错误(函数的返回值不在规定的范围内) 三角函数反余弦acos 反正弦asin 反正切atan 反正切2 atan2 余弦cos 正弦sin 正切tan 双曲函数双曲余弦cosh 双曲正弦sinh 双曲正切tanh 指数和对数指数函数exp 指数分解函数frexp 乘积指数函数fdexp 自然对数log 以10为底的对数log10 浮点数分解函数modf 幂函数幂函数pow 平方根函数sqrt 整数截断,绝对值和求余数函数求下限接近整数ceil 绝对值fabs 求上限接近整数floor 求余数fmod 本分类函数用于实现在不同底函数之间直接跳转代码。头文件setjmp.h io.h

免费的单片机C语言常用头文件

免费的函数原形的头文件读者可参考返回非整型值的函数 函数原形的头文件读者可参考返回非整型值的函数assert.h - assert(), 声明宏 ctype.h –字符类型函数 float.h –浮点数原形 limits.h –数据类型的大小和范围 math.h –浮点运算函数 stdarg.h –变量参数表. stddef.h –标准定义 stdio.h –标准输入输出IO 函数 stdlib.h –包含内存分配函数的标准库 string.h –字符串处理函数 3 字符类型库 下列函数按照输入的ACS II 字符集字符分类使用这些函数之前应当用"#include " 包含 int isalnum(int c) 如果c 是数字或字母返回非零数值否则返回零 int isalpha(int c) 如果c 是字母返回非零数值否则返回零 int iscntrl(int c) 如果c 是控制字符如FF, BELL, LF ..等返回非零数值否则返回零 int isdigit(int c) 如果c 是数字返回非零数值否则返回零

int isgraph(int c) 如果c 是一个可打印字符而非空格返回非零数值否则返回零 int islower(int c) 如果c 是小写字母返回非零数值否则返回零 int isprint(int c) 如果c 是一个可打印字符返回非零数值否则返回零 int ispunct(int c) 如果c 是一个可打印字符而不是空格数字或字母返回非零数值否则返回零 int isspace(int c) 如果c 是一个空格字符返回非零数值包括空格CR, FF, HT, NL, 和VT 否则返回零 int isupper(int c) 如果c 是大写字母返回非零数值否则返回零 int isxdigit(int c) 如果c 是十六进制数字返回非零数值否则返回零 int tolower(int c) 如果c 是大写字母则返回c 对应的小写字母其它类型仍然返回c int toupper(int c) 如果c 是小写字母则返回c 对应的大写字母其它类型仍然返回c 4 浮点运算库 下列函数支持浮点数运算使用这些函数之前必须用 #include 包含 float asin(float x) 以弧度形式返回x 的反正弦值 float acos(float x)

C语言中,头文件和源文件的关系

C语言中,头文件和源文件的关系(转) 简单的说其实要理解C文件与头文件(即.h)有什么不同之处,首先需要弄明白编译器的工作过程,一般说来编译器会做以下几个过程: 1.预处理阶段 2.词法与语法分析阶段 3.编译阶段,首先编译成纯汇编语句,再将之汇编成跟CPU相关的二进制码,生成各个目标文件(.obj文件) 4.连接阶段,将各个目标文件中的各段代码进行绝对地址定位,生成跟特定平台相关的可执行文件,当然,最后还可以用objcopy生成纯二进制码,也就是去掉了文件格式信息。(生成.exe文件) 编译器在编译时是以C文件为单位进行的,也就是说如果你的项目中一个C文件都没有,那么你的项目将无法编译,连接器是以目标文件为单位,它将一个或多个目标文件进行函数与变量的重定位,生成最终的可执行文件,在PC上的程序开发,一般都有一个main函数,这是各个编译器的约定,当然,你如果自己写连接器脚本的话,可以不用main函数作为程序入口!!!! (main .c文件目标文件可执行文件) 有了这些基础知识,再言归正传,为了生成一个最终的可执行文件,就需要一些目标文件,也就是需要C文件,而这些C文件中又需要一个main 函数作为可执行程序的入口,那么我们就从一个C文件入手,假定这个C文件内容如下: #include #include "mytest.h" int main(int argc,char **argv) { test = 25; printf("test.................%d/n",test); } 头文件内容如下: int test; 现在以这个例子来讲解编译器的工作: 1.预处理阶段:编译器以C文件作为一个单元,首先读这个C文件,发现第一句与第二句是包含一个头文件,就会在所有搜索路径中寻找这两个文件,找到之后,就会将相应头文件中再去处理宏,变量,函数声明,嵌套的头文件包含等,检测依赖关系,进行宏替换,看是否有重复定义与声明的情况发生,最后将那些文件中所有的东东全部扫描进这个当前的C文件中,形成一个中间“C文件” 2.编译阶段,在上一步中相当于将那个头文件中的test变量扫描进了一个中间C文件,那么test变量就变成了这个文件中的一个全局变量,此时就将所有这个中间C文件的所有变量,函数分配空间,将各个函数编译成二进制码,按照特定目标文件格式生成目标文件,在这种格式的目标文件中进行各个全局变量,函数的符号描述,将这些二进制码按照一定的标准组织成一个目标文件 3.连接阶段,将上一步成生的各个目标文件,根据一些参数,连接生成最终的可执行文件,主要的工作就是重定位各个目标文件的函数,变量等,相当于将个目标文件中的二进制码按一定的规范合到一个文件中再回到C文件与头文件各写什么内容的话题上:理论上来说C文件与头文件里的内容,只要是C语言所支持的,无论写什么都可以的,比如你在头文件中写函数体,只要在任何一个C文件包含此头文件就可以将这个函数编译成目标文件的一部分(编译是以C文件为单位的,如果不在任何C文件中包含此头文件的话,这段代码就形同虚设),你可以在C文件中进行函数声明,变量声明,结构体声明,这也不成问题!!!那为何一定要分成头文件与C文件呢?又为何一般都在头件中进行函数,变量声明,宏声明,结构体声明呢?而在C文件中去进行变量定义,函数实现呢??原因如下: 1.如果在头文件中实现一个函数体,那么如果在多个C文件中引用它,而且又同时编译多个C文件,将其生成的目标文件连接成一个可执行文件,在每个引用此头文件的C文件所生成的目标文件中,都有一份这个函数的代码,如果这段函数又没有定义成局部函数,那么在连接时,就会发现多个相同的函数,就会报错 2.如果在头文件中定义全局变量,并且将此全局变量赋初值,那么在多个引用此头文件的C文件中同样存在相同变量名的拷贝,关键是此变量被

c语言中常用的函数和头文件

头文件ctype.h 函数列表<> 函数类别函数用途详细说明 字符测试是否字母和数字isalnum 是否字母isalpha 是否控制字符iscntrl 是否数字isdigit 是否可显示字符(除空格外)isgraph 是否可显示字符(包括空格)isprint 是否既不是空格,又不是字母和数字的可显示字符ispunct 是否空格isspace 是否大写字母isupper 是否16进制数字(0-9,A-F)字符isxdigit 字符大小写转换函数转换为大写字母toupper 转换为小写字母tolower 地区化 本类别的函数用于处理不同国家的语言差异。 头文件local.h 函数列表 函数类别函数用途详细说明 地区控制地区设置setlocale 数字格式约定查询国家的货币、日期、时间等的格式转换localeconv 数学函数 本分类给出了各种数学计算函数,必须提醒的是ANSI C标准中的数据格式并不符合IEEE754标准,一些C语言编译器却遵循IEEE754(例如frinklin C51) 头文件math.h 函数列表 函数类别函数用途详细说明 错误条件处理定义域错误(函数的输入参数值不在规定的范围内) 值域错误(函数的返回值不在规定的范围内) 三角函数反余弦acos 反正弦asin 反正切atan 反正切2 atan2 余弦cos

正弦sin 正切tan 双曲函数双曲余弦cosh 双曲正弦sinh 双曲正切tanh 指数和对数指数函数exp 指数分解函数frexp 乘积指数函数fdexp 自然对数log 以10为底的对数log10 浮点数分解函数modf 幂函数幂函数pow 平方根函数sqrt 整数截断,绝对值和求余数函数求下限接近整数ceil 绝对值fabs 求上限接近整数floor 求余数fmod 本分类函数用于实现在不同底函数之间直接跳转代码。头文件setjmp.h io.h 函数列表 函数类别函数用途详细说明 保存调用环境setjmp 恢复调用环境longjmp 信号处理 该分类函数用于处理那些在程序执行过程中发生例外的情况。 头文件signal.h 函数列表 函数类别函数用途详细说明 指定信号处理函数signal 发送信号raise 可变参数处理 本类函数用于实现诸如printf,scanf等参数数量可变底函数。 头文件stdarg.h 函数列表

单片机C语言常用头文件

函数原形的头文件读者可参考返回非整型值的函数 assert.h - assert(), 声明宏 ctype.h –字符类型函数 float.h –浮点数原形 limits.h –数据类型的大小和范围 math.h –浮点运算函数 stdarg.h –变量参数表. stddef.h –标准定义 stdio.h –标准输入输出IO 函数 stdlib.h –包含内存分配函数的标准库 string.h –字符串处理函数 3 字符类型库 下列函数按照输入的ACS II 字符集字符分类使用这些函数之前应当用"#include " 包含 int isalnum(int c) 如果c 是数字或字母返回非零数值否则返回零 int isalpha(int c) 如果c 是字母返回非零数值否则返回零 int iscntrl(int c) 如果c 是控制字符如FF, BELL, LF ..等返回非零数值否则返回零 int isdigit(int c) 如果c 是数字返回非零数值否则返回零 int isgraph(int c) 如果c 是一个可打印字符而非空格返回非零数值否则返回零 int islower(int c) 如果c 是小写字母返回非零数值否则返回零 int isprint(int c) 如果c 是一个可打印字符返回非零数值否则返回零 int ispunct(int c) 如果c 是一个可打印字符而不是空格数字或字母返回非零数值否则返回零 int isspace(int c) 如果c 是一个空格字符返回非零数值包括空格CR, FF, HT, NL, 和VT 否则返回零 int isupper(int c) 如果c 是大写字母返回非零数值否则返回零 int isxdigit(int c) 如果c 是十六进制数字返回非零数值否则返回零 int tolower(int c) 如果c 是大写字母则返回c 对应的小写字母其它类型仍然返回c int toupper(int c) 如果c 是小写字母则返回c 对应的大写字母其它类型仍然返回c 4 浮点运算库 下列函数支持浮点数运算使用这些函数之前必须用#include 包含 float asin(float x) 以弧度形式返回x 的反正弦值

C语言头文件大全

标准C语言头文件 ISO C 标准定义的头文件(24 项)类型 实现常量 尔类型和值 通用类型数学宏 分类和映射支持 匹配类型 ? 路径名模式匹配类型库操作? 组文件? 网络数据 验证程序断言?支持复数算术运算? 字符? 出错码? 浮点环境? 浮点常量 ? 整型格式转换 替代关系操作符宏? ? 局部类别?数学常量 非局部goto ? 信号? 可变参数表? 布? 标准定义? 整型? 标准I/O ? 实用程序库函数? 字符串操作? ? 时间和日期?宽字符支持vwct yp e.h>?宽字符POSIX标准定义的必须的头文件(26 项) ? 目录项? 文件控制? 文件名 口令文件? 正则表达式?tar 归档值

? 终端 I/O ? 符号常量 ? 文件时间 ?消息队列 资源操作 ?信号量 vwordex p.h>?字扩展类型 本地接口 ?Internet 定义 ? 套接字 Internet 地址族 ? 传输控制协议 vsys/mma n.h>?内存 管理声明 ?selec t 状态 函数 ? 套接字接口 ? 文件 ? 进程时间 套接字定义 ? 基本系统数据类型 ?UNIX 域 系统名 ? 进程控制 POSIX 标准定义的XSI 扩展头文件(26项) cpio 归档值 示结构 ? 动态链接 vfmtmsg.h>?消息显 ? 文件树漫游 ? 代码集转换实用程序 ? 语 言信息常量 ? 模式匹配函数定义 作 ? 货币类型 ?数据库操 ? 消息类别 ? 轮询函数 ? 搜索表 ? 字符串操作 上下文 ? 系统出错日志记录 ? 用户 ? 用户限制 ?用户帐户数据库 IPC

C语言头文件作用及写法

C语言头文件作用及写法 头文件几个好处: 1,头文件可以定义所用的函数列表,方便查阅你可以调用的函数; 2,头文件可以定义很多宏定义,就是一些全局静态变量的定义,在这样的情况下,只要修改头文件的内容,程序就可以做相应的修改,不用亲自跑到繁琐的代码内去搜索。 3,头文件只是声明,不占内存空间,要知道其执行过程,要看你头文件所申明的函数是在哪个.c文件里定义的,才知道。 4,他并不是C自带的,可以不用。 5,调用了头文件,就等于赋予了调用某些函数的权限,如果你要算一个数的N次方,就要调用Pow()函数,而这个函数是定义在math.c里面的,要用这个函数,就必需调用math.h 这个头文件。 头文件写法: #include ... //------------------------------- #ifndef MY_POINT #define MY_POINT class Class1 { } class Class2 { } ... #endif 在要使用类定义的文件中加入 #include "头文件名.h " 一般来说,头文件里多数是放的函数定义或函数体。 此外,还有: #ifndef **** #define **** …… #endif 之类的语句,用于控制#define 与#endif之间的内容不被重复定义或插入。 #include 语句起的只是一个插入作用。 也就是说,#include 的文件里的内容可以随便写。 编译器使用#include 的文件里的内容来插入到#include 所在位置。 所以,你说的“头文件”没有固定格式。

如要使用其它头文件中的函数,可以直接在你的头文件中引用。 初学C语言,个人建议你使用C++Builder 6去练习和理解,当然,这要求你有一定的英语水平.在很多情况下会自动的帮你加好头文件,你可以观察它自动生成的文件,代码,以进一步学习。 example: 我截了一小段 /* math.h Definitions for the math floating point package. Copyright (c) 1987, 1991 by Borland International All Rights Reserved. */ #ifndef __MATH_H #define __MATH_H #if !defined( __DEFS_H ) #include <_defs.h> #endif #define HUGE_VAL _huge_dble extern double _Cdecl _huge_dble; #define _LHUGE_VAL _huge_ldble extern long double _Cdecl _huge_ldble; #ifdef __cplusplus extern "C" { #endif double _Cdecl acos (double __x); double _Cdecl asin (double __x); double _Cdecl atan (double __x); double _Cdecl atan2 (double __y, double __x); double _Cdecl ceil (double __x); double _Cdecl cos (double __x); double _Cdecl cosh (double __x); double _Cdecl exp (double __x); double _Cdecl fabs (double __x); double _Cdecl __fabs__ (double __x); /* Intrinsic */ double _Cdecl floor (double __x); double _Cdecl fmod (double __x, double __y); double _Cdecl frexp (double __x, int *__exponent);

C语言所有常用头文件用途

C语言所有常用头文件用途 字符处理函数 本类别函数用于对单个字符进行处理,包括字符的类别测试和字符的大小写转换 头文件ctype.h 函数列表<> 函数类别函数用途详细说明 字符测试是否字母和数字isalnum 是否字母isalpha 是否控制字符iscntrl 是否数字isdigit 是否可显示字符(除空格外)isgraph 是否可显示字符(包括空格)isprint 是否既不是空格,又不是字母和数字的可显示字符ispunct 是否空格isspace 是否大写字母isupper 是否16进制数字(0-9,A-F)字符isxdigit 字符大小写转换函数转换为大写字母toupper 转换为小写字母tolower 地区化 本类别的函数用于处理不同国家的语言差异。 头文件local.h 函数列表 函数类别函数用途详细说明 地区控制地区设置setlocale 数字格式约定查询国家的货币、日期、时间等的格式转换localeconv 数学函数 本分类给出了各种数学计算函数,必须提醒的是ANSI C标准中的数据格式并不符合IEEE754标准,一些C语言编译器却遵循IEEE754(例如frinklin C51) 头文件math.h 函数列表 函数类别函数用途详细说明 错误条件处理定义域错误(函数的输入参数值不在规定的范围内)

值域错误(函数的返回值不在规定的范围内) 三角函数反余弦acos 反正弦asin 反正切atan 反正切2 atan2 余弦cos 正弦sin 正切tan 双曲函数双曲余弦cosh 双曲正弦sinh 双曲正切tanh 指数和对数指数函数exp 指数分解函数frexp 乘积指数函数fdexp 自然对数log 以10为底的对数log10 浮点数分解函数modf 幂函数幂函数pow 平方根函数sqrt 整数截断,绝对值和求余数函数求下限接近整数ceil 绝对值fabs 求上限接近整数floor 求余数fmod 本分类函数用于实现在不同底函数之间直接跳转代码。头文件setjmp.h io.h 函数列表 函数类别函数用途详细说明 保存调用环境setjmp 恢复调用环境longjmp 信号处理 该分类函数用于处理那些在程序执行过程中发生例外的情况。 头文件signal.h 函数列表 函数类别函数用途详细说明 指定信号处理函数signal 发送信号raise 可变参数处理 本类函数用于实现诸如printf,scanf等参数数量可变底函数。

C语言常用头文件及函数

#include(errno.h):错误处理 #include (stdio.h):格式化输入与输出函数 fprintf函数,功能:格式输出(文件) fscanf函数,功能:格式输入(文件) printf函数,功能:格式输出(控制台) scanf函数,功能:格式输入(控制台) fclose函数,功能:关闭文件 fopen函数,功能:打开文件 feof函数,功能:文件结尾判断 ferror函数,功能:文件错误检测 freopen函数,功能:将已存在的流指针和新文件连接 setbuf函数,功能:设置磁盘缓冲区 sscanf函数,功能:从缓冲区中按格式输入 sprintf函数,功能:格式输出到缓冲区 remove函数,功能:删除文件 rename函数,功能:修改文件名称 tmpfile函数,功能:生成临时文件名称 tmpnam函数,功能:得到临时文件路径 fgetc函数,功能:输入一个字符(文件) fgets函数,功能:字符串输入(文件) fputc函数,功能:字符输出(文件) fputs函数,功能:字符串输出(文件) gets函数,功能:字符串输入(控制台) getchar函数,功能:字符输入(控制台) getc函数,功能:字符输入(控制台) putc函数,功能:字符输出(控制台) putchar函数,功能:字符输出(控制台) ungetc函数,功能:字符输出到流的头部 fread函数,功能:直接流读操作 fwrite函数,功能:直接流写操作 fgetpos函数,功能:得到文件位置 fsetpos函数,功能:文件位置设置 fseek函数,功能:文件位置移动 ftell函数,功能:得到文件位置 remind函数,功能:文件位置复零位 perror函数,功能:得到错误提示字符串 clearerr函数,功能:错误清除 puts函数,功能:字符串输出(控制台)

C语言头文件的使用与写法

C语言头文件的使用与写法。 2009年04月20日星期一23:12 C语言中的.h文件和我认识由来已久,其使用方法虽不十分复杂,但我却是经过了几个月的“不懂”时期,几年的“一知半解”时期才逐渐认识清楚他的本来面目。揪其原因,我的驽钝和好学而不求甚解固然是原因之一,但另外还有其他原因。原因一:对于较小的项目,其作用不易被充分开发,换句话说就是即使不知道他的详细使用方法,项目照样进行,程序在计算机上照样跑。原因二:现在的各种C语言书籍都是只对C语言的语法进行详细的不能再详细的说明,但对于整个程序的文件组织构架却只字不提,找了好几本比较著名的C语言著作,却没有一个把.h文件的用法写的比较透彻的。下面我就斗胆提笔,来按照我对.h 的认识思路,向大家介绍一下。 让我们的思绪乘着时间机器回到大学一年级。C原来老师正在讲台上讲着我们的第一个C语言程序: Hello world! 文件名 First.c main() { printf(“Hello world!”); } 例程-1 看看上面的程序,没有.h文件。是的,就是没有,世界上的万物都是经历从没有到有的过程的,我们对.h的认识,我想也需要从这个步骤开始。这时确实不需要.h文件,因为这个程序太简单了,根本就不需要。那么如何才能需要呢?让我们把这个程序变得稍微复杂些,请看下面这个, 文件名 First.c printStr() { printf(“Hello world!”); } main() {

printStr() } 例程-2还是没有, 那就让我们把这个程序再稍微改动一下. 文件名 First.c main() { printStr() } printStr() { printf(“Hello world!”); } 例程-3等等,不就是改变了个顺序嘛, 但结果确是十分不同的. 让我们编译一下例程-2和例程-3,你会发现例程-3是编译不过的.这时需要我们来认识一下另一个C语言中的概念:作用域.我们在这里只讲述与.h文件相关的顶层作用域, 顶层作用域就是从声明点延伸到源程序文本结束, 就printStr()这个函数来说,他没有单独的声明,只有定义,那么就从他定义的行开始,到first.c文件结束, 也就是说,在例程-2的main()函数的引用点上,已经是他的作用域. 例程-3的main()函数的引用点上,还不是他的作用域,所以会编译出错. 这种情况怎么办呢? 有两种方法 ,一个就是让我们回到例程-2, 顺序对我们来说没什么, 谁先谁后不一样呢,只要能编译通过,程序能运行, 就让main()文件总是放到最后吧. 那就让我们来看另一个例程,让我们看看这个方法是不是在任何时候都会起作用. 文件名 First.c play2() { play1() }

补充关于c语言头文件的知识

String.h C语言里面关于字符数组的函数定义的头文件,常用函数有strlen、strcmp、strcpy等等,更详细的可以到include文件夹里面查看该文件。 #include //设定插入点 #include //字符处理 #include //定义错误码 #include //浮点数处理 #include //文件输入/输出 #include //参数化输入/输出 #include //数据流输入/输出 #include //定义各种数据类型最值常量 #include //定义本地化函数 #include //定义数学函数 #include //定义输入/输出函数 #include //定义杂项函数及内存分配函数 #include //字符串处理 #include //基于数组的输入/输出 #include //定义关于时间的函数 #include //宽字符处理及输入/输出 #include //宽字符分类 2、标准C++ 其中包括的头文件如下(同上的不再注释) #include //STL 通用算法 #include //STL 位集容器 #include #include #include #include #include //复数类 #include #include #include #include #include //STL 双端队列容器 #include //异常处理类 #include

C语言 函数大全(头文件)

C标准库函数 abort stdlib. h abs stdlib. h acos math. h asctime time. h asin math. h assert assert.h atan math. h atan2 math. h atexit stdlib. h atof stdlib. h atoi stdlib. h atol stdlib. h bsearch stdlib. h BUFSIZ stdio. h calloc stdlib. h ceil math. h clearerr stdio. h clock time. h CLOCKS-PER-SEC time. h clock_t time. h cos math. h cosh math. h ctime time. h difftime time. h div stdlib. h div_t stdlib. h EDOM errno. h EOF stdio. h ERANGE errno. h errno errno. h exit stdlib. h EXIT_FAILURE stdlib. h EXIT_SUCCESS stdlib. h exp math. h fabs math. h fclose stdio. h feof stdio.h ferror stdio.h fflush stdio. h fgetc stdio.h fgetpos stdio. h

FILE stdio. h FILENAME-MAX stdio. h floor math. h isalpha ctype. h iscntrl ctype. h isdigit ctype. h isgraph ctype. h islower ctype. h isprint ctype. h ispunct ctype. h isspace ctype. h isupper ctype. h isxdigit ctype. h jmp_buf setjmp. h labs stdlib. h LC_ALL locale. h LC_COLLATE locale. h LC_CTYPE locale. h LC_MONETARY locale. h LC_NUMERIC locale. h LC_TIME locale. h struct lconv locale. h ldexp math. h ldiv stdlib. h ldiv_t stdlib. h localeconv locale. h localtime time. h log math. h log10 math. h longjmp setjmp. h L_tmpnam stdio. h malloc stdlib. h mblen stdlib. h mbstowcs stdlib. h mbtowc stdlib. h MB_CUR_MAX stdlib. h memchr string. h memcmp string. h memcpy string. h memmove string. h memset string. h

标准C语言头文件

标准C语言头文件 ISO C标准定义的头文件(24项) 验证程序断言 支持复数算术运算 字符类型 出错码 浮点环境 浮点常量 整型格式转换 替代关系操作符宏 实现常量 局部类别 数学常量 非局部goto 信号 可变参数表 布尔类型和值 标准定义 整型 标准I/O库 实用程序库函数 字符串操作 时间和日期 宽字符支持 POSIX标准定义的必须的头文件(26项) 目录项 文件控制 路径名模式匹配类型 组文件 口令文件 正则表达式 终端I/O 符号常量 字扩展类型 Internet定义 Internet地址族 传输控制协议 select函数 套接字接口

c语言头文件的建立与使用

嵌入式c语言头文件的建立与使用 如何正确编写C语言头文件和与之相关联的c源程序文件,这首先就要了解它们的各自功能。要理解C文件与头文件(即.h)有什么不同之处,首先需要弄明白编译器的工作过程。 一般说来编译器会做以下几个过程: 1.预处理阶段 2.编译阶段,首先编译成纯汇编语句,再将之汇编成跟CPU相关的二进制码,生成各个目标文件(.obj文件) 3.连接阶段,将各个目标文件中的各段代码进行绝对地址定位,生成跟特定平台相关的可执行文件。 编译器在编译时是以C文件为单位进行的,也就是说如果你的项目中一个C文件都没有,那么你的项目将无法编译,连接器是以目标文件为单位,它将一个或多个目标文件进行函数与变量的重定位,生成最终的可执行文件。 为了生成一个最终的可执行文件,就需要一些目标文件,也就是首先要有C文件,而这些C文件中又需要一个main()函数作为可执行程序的入口,那么我们就从从这一个C文件入手,引入头文件概念。

假定这个C文件内容如下: #include #include"mytest.h" int main(int argc,char**argv) { test=25; printf("test........... %d\n",test); } 头文件"mytest.h"包含如下内容: int test; 现在以这个例子来讲解编译器的工作: 1.预处理阶段:编译器以C文件作为一个单元,首先读这个C文件,发现第一句与第二句是包含一个头文件,就会在所有搜索路径中寻找这两个文件,找到之后,就会将相应头文件中的宏,变量,函数声明,嵌套的头文件包含等,进行依赖关系检测,并进行宏替换,看是否有重复声

C语言头文件大全

C系统提供了丰富的系统文件,称为库文件,C的库文件分为两类,一类是扩展名为".h"的文件,称为头文件,在前面的包含命令中我们已多次使用过。在".h"文件中包含了常量定义、类型定义、宏定义、函数原型以及各种编译选择设置等信息。另一类是函数库,包括了各种函数的目标代码,供用户在程序中调用。通常在程序中调用一个库函数时,要在调用之前包含该函数原型所在的".h" 文件。 下面给出Turbo C的全部".h"文件。 Turbo C头文件 ALLOC.Hν说明内存管理函数(分配、释放等)。 ASSERT.Hν定义assert调试宏。 BIOS.Hν说明调用IBM—PC ROM BIOS子程序的各个函数。CONIO.Hν说明调用DOS控制台I/O子程序的各个函数。 CTYPE.Hν包含有关字符分类及转换的名类信息(如isalpha和toascii 等)。 DIR.Hν包含有关目录和路径的结构、宏定义和函数。 DOS.Hν定义和说明MSDOS和8086调用的一些常量和函数。ERRON.Hν定义错误代码的助记符。 FCNTL.Hν定义在与open库子程序连接时的符号常量。 FLOAT.Hν包含有关浮点运算的一些参数和函数。 GRAPHICS.Hν说明有关图形功能的各个函数,图形错误代码的常量定义,正对不同驱动程序的各种颜色值,及函数用到的一些特殊结构。 IO.Hν包含低级I/O子程序的结构和说明。 LIMIT.Hν包含各环境参数、编译时间限制、数的范围等信息。 MATH.Hν说明数学运算函数,还定了HUGE VAL 宏,说明了matherr和matherr子程序用到的特殊结构。 MEM.Hν说明一些内存操作函数(其中大多数也在STRING.H中说明)。PROCESS.Hν说明进程管理的各个函数,spawn…和EXEC …函数的结构说明。 SETJMP.Hν定义longjmp和setjmp函数用到的jmp buf类型,说明这两个函数。 SHARE.Hν定义文件共享函数的参数。 SIGNAL.Hν定义SIG[ZZ(Z] [ZZ)]IGN和SIG[ZZ(Z] [ZZ)]DFL常量,说明rajse和signal两个函数。 STDARG.Hν定义读函数参数表的宏。(如vprintf,vscarf函数)。STDDEF.Hν定义一些公共数据类型和宏。 STDIO.Hν定义Kernighan和Ritchie在Unix System V 中定义的标准和扩展的类型和宏。还定义标准I/O 预定义流:stdin,stdout和stderr,说明I/O 流子程序。 STDLIB.Hν说明一些常用的子程序:转换子程序、搜索/ 排序子程序等。STRING.Hν说明一些串操作和内存操作函数。 SYS\STAT.Hν定义在打开和创建文件时用到的一些符号常量。 SYS\TYPES.Hν说明ftime函数和timeb结构。

C语言头文件大全

C语言头文件大全 #include //设定插入点 #include //字符处理 #include //定义错误码 #include //浮点数处理 #include //文件输入/输出 #include //参数化输入/输出 #include //数据流输入/输出 #include //定义各种数据类型最值常量 #include //定义本地化函数 #include //定义数学函数 #include //定义输入/输出函数 #include //定义杂项函数及内存分配函数 #include //字符串处理 #include //基于数组的输入/输出 #include //定义关于时间的函数 #include //宽字符处理及输入/输出 #include //宽字符分类 ////////////////////////////////////////////////////////////////////////// ////// 标准C++ (同上的不再注释) #include //STL通用算法 #include //STL位集容器

#include #include #include #include #include //复数类 #include #include #include #include #include //STL双端队列容器 #include //异常处理类 #include #include //STL 定义运算函数(代替运算符)#include #include //STL 线性列表容器 #include //STL 映射容器 #include #include //基本输入/输出支持 #include //输入/输出系统使用的前置声明 #include #include //基本输入流 #include //基本输出流

C语言的头文件使用技巧

C语言中的.h文件和我认识由来已久,其使用方法虽不十分复杂,但我却是经过了几个月的“不懂”时期,几年的“一知半解”时期才逐渐认识清楚他的本来面目。揪其原因,我的驽钝和好学而不求甚解固然是原因之一,但另外还有其他原因。原因一:对于较小的项目,其作用不易被充分开发,换句话说就是即使不知道他的详细使用方法,项目照样进行,程序在计算机上照样跑。原因二:现在的各种C语言书籍都是只对C语言的语法进行详细的不能再详细的说明,但对于整个程序的文件组织构架却只字不提,找了好几本比较著名的C语言著作,却没有一个把.h文件的用法写的比较透彻的。下面我就斗胆提笔,来按照我对.h 的认识思路,向大家介绍一下。 让我们的思绪乘着时间机器回到大学一年级。C原来老师正在讲台上讲着我们的第一个C语言程序: Hello world! 文件名 First.c main() { printf(“Hello world!”); } 例程-1 看看上面的程序,没有.h文件。是的,就是没有,世界上的万物都是经历从没有到有的过程的,我们对.h的认识,我想也需要从这个步骤开始。这时确实不需要.h文件,因为这个程序太简单了,根本就不需要。那么如何才能需要呢?让我们把这个程序变得稍微复杂些,请看下面这个, 文件名 First.c printStr() { printf(“Hello world!”); } main() { printStr(); } 例程-2 还是没有, 那就让我们把这个程序再稍微改动一下. 文件名 First.c main() { printStr(); }

printStr() { printf(“Hello world!”); } 例程-3 等等,不就是改变了个顺序嘛, 但结果确是十分不同的. 让我们编译一下例程-2和例程-3,你会发现例程-3是编译不过的.这时需要我们来认识一下另一个C语言中的概念:作用域. 我们在这里只讲述与.h文件相关的顶层作用域, 顶层作用域就是从声明点延伸到源程序文本结束, 就printStr()这个函数来说,他没有单独的声明,只有定义,那么就从他定义的行开始,到first.c文件结束, 也就是说,在在例程-2的main()函数的引用点上,已经是他的作用域. 例程-3的main()函数的引用点上,还不是他的作用域,所以会编译出错. 这种情况怎么办呢? 有两种方法 ,一个就是让我们回到例程-2, 顺序对我们来说没什么, 谁先谁后不一样呢,只要能编译通过,程序能运行, 就让main()文件总是放到最后吧. 那就让我们来看另一个 例程,让我们看看这个方法是不是在任何时候都会起作用. 文件名 First.c play2() { ………………. play1(); ……………….. } play1(){ …………….. play2(); …………………… } main() { play1(); } 例程-4 也许大部分都会看出来了,这就是经常用到的一种算法, 函数嵌套, 那么让我们看看, play1和play2这两个函数哪个放到前面呢? 这时就需要我们来使用第二种方法,使用声明. 文件名 First.c play1();

相关文档