C 库函数 - exit()

C 语言教程 · 2019-02-24 08:44:14

描述

C 库函数 void exit(int status) 立即终止调用进程。任何属于该进程的打开的文件描述符都会被关闭,该进程的子进程由进程 1 继承,初始化,且会向父进程发送一个 SIGCHLD 信号。

声明

下面是 exit() 函数的声明。

void exit(int status)

参数

  • status -- 返回给父进程的状态值。

返回值

该函数不返回值。

实例

下面的实例演示了 exit() 函数的用法。

#include <stdio.h>
#include <stdlib.h>

int main ()
{
   printf("程序的开头....\n");
   
   printf("退出程序....\n");
   exit(0);

   printf("程序的结尾....\n");

   return(0);
}

让我们编译并运行上面的程序,这将产生以下结果:

程序的开头....
退出程序....

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Out of Control

Out of Control

Kevin Kelly / Basic Books / 1995-4-14 / USD 22.95

Out of Control is a summary of what we know about self-sustaining systems, both living ones such as a tropical wetland, or an artificial one, such as a computer simulation of our planet. The last chap......一起来看看 《Out of Control》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试