exit() 函数 在哪个头文件里???

如题所述

函数名: exit()
所在头文件:stdlib.h(如果是”VC6.0“的话头文件为:windows.h)
功 能: 关闭所有文件,终止正在执行的进程。
exit(1)表示异常退出.这个1是返回给操作系统的。
exit(x)(x不为0)都表示异常退出
exit(0)表示正常退出
exit()的参数会被传递给一些操作系统,包括UNIX,Linux,和MS DOS,以供其他程序使用。
stdlib.h: void exit(int status);
参 数 : status //程序退出的返回值.
实例
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
int main(intargc,char*argv[])
{
int status;
printf("Entereither1or2\n");
status=getch();
/*SetsDOSerrorlevel*/
exit(status-'0');
/*Note:thislineisneverreached*/
return0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-06-14

函数名: exit()

所在头文件:stdlib.h(如果是”VC6.0“的话头文件为:windows.h)

功 能: 关闭所有文件,终止正在执行的进程。

exit(1)表示异常退出.这个1是返回给操作系统的。

exit(x)(x不为0)都表示异常退出

exit(0)表示正常退出

exit()的参数会被传递给一些操作系统,包括UNIX,Linux,和MS DOS,以供其他程序使用。

stdlib.h: void exit(int status);

参 数 : status //程序退出的返回值.

实例

#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
int main(intargc,char*argv[])
{
int status;
printf("Entereither1or2\n");
status=getch();
/*SetsDOSerrorlevel*/
exit(status-'0');
/*Note:thislineisneverreached*/
return0;
}

第2个回答  2006-10-05
#include <stdlib.h>

void exit(int status)
exit causes normal program termination. atexit functions are called in reverse order of registration, open files are flushed, open streams are closed, and control is returned to the environment. How status is returned to the environment is implementation-dependent, but zero is taken as successful termination. The values EXIT_SUCCESS and EXIT_FAILURE may also be used.

参考资料:the c programming language

第3个回答  2006-10-05
#include <conio.h>
#include <stdlib.h>本回答被提问者采纳
相似回答