return从当前函数返回而exit结束正在运行的程序

示例:

[wangml@iZwz976helaylvgqok97prZ testForC]$ ./exit.test
q
[wangml@iZwz976helaylvgqok97prZ testForC]$ ./exit.test
a
Here!
[wangml@iZwz976helaylvgqok97prZ testForC]$ cat exit.test.c
#include <stdio.h>
#include <stdlib.h> void testExit(char ch); int main(int argc, char **argv)
{
char ch;
scanf("%c", &ch); testExit(ch); printf("Here!\n"); return ;
} void testExit(char ch)
{
if (ch == 'q')
{
exit();
} return;
}

return和exit的更多相关文章

  1. return和exit函数的区别

    在上Linux课的时候,老师提到一句,调用vfork产生的子进程就是为了使用exec族函数来执行其他的代码逻辑. 在子进程退出的时候有两种方式,exit和exec族函数,不能使用return,为什么不 ...

  2. 关于return和exit

    关于return和exit 在子进程退出的时候有两种方式,exit和exec族函数,不能使用return,为什么不能用return呢,exit改成return 会出现父子进程又各自重复开始进行. 1. ...

  3. 理解 break, continue, return 和 exit

    你们知道 “break”, “continue”, “return” 和 “exit”的作用吗? 它们是功能强大的语言结构体.下面通过一个测试函数来说明它们之间的不同. 1 2 3 4 5 6 7 8 ...

  4. Linux编程return与exit区别

    Linux编程return与exit区别 exit  是用来结束一个程序的执行的,而return只是用来从一个函数中返回. return return 表示从被调函数返回到主调函数继续执行,返回时可附 ...

  5. DevC++ return 1 exit status

    当使用DevC++时编译运行程序出现 return 1 exit status 有可能是因为有在运行的命令窗口未关闭.

  6. Windows下return,exit和ExitProcess的区别和分析

    通常,我们为了使自己的程序结束,会在主函数中使用return或调用exit().在windows下还有ExitProcess()和TerminateProcess()等函数. 本文的目的是比较以上几种 ...

  7. C++中的return和exit区别

    在main函数中,return和exit经常混用,两者的一个区别:return会执行statck unwinding,而exit不会.如果触发了信号,exit也同样不会做stack unwinding ...

  8. oracle 存储过程循环体中的return和exit区别:

    oracle 存储过程循环体中的return和exit区别:   (1) return 跳出整个循环,终止该循环, 后面的不再执行.     相当于 Java 中的break;   (2)  exit ...

  9. return 与 exit() 的区别

    return是一个关键字,返回函数值:exit()是一个函数: return是语言级的:exit()是操作系统提供的函数: return表示函数退出:exit()表示进程退出: 非主函数中调用retu ...

  10. return die exit 常用

    die()停止程序运行,输出内容exit是停止程序运行,不输出内容return是返回值die是遇到错误才停止exit是直接停止,并且不运行后续代码,exit()可以显示内容.return就是纯粹的返回 ...

随机推荐

  1. STM32F407 SPI 个人笔记

    概述 SPI ,Serial Peripheral interface,串行外围设备接口 全双工,同步的通信总线,四根线 主要应用在 EEPROM,FLASH,实时时钟,AD转换器,还有数字信号处理器 ...

  2. numpy array_split()

    numpy.array_split(ary, indices_or_sections, axis=0)[source] Split an array into multiple sub-arrays. ...

  3. RabbitMQ的transaction、confirm、ack三个概念的解释

    在使用RabbitMQ的过程中,肯定会遇到这样的几个概念:transaction.confirm.ack.本文介绍一下这几个概念,以及他们之间的关系. RabbitMQ是采用的AMQP协议,AMQP协 ...

  4. 【leetcode dp】132. Palindrome Partitioning II

    https://leetcode.com/problems/palindrome-partitioning-ii/description/ [题意] 给定一个字符串,求最少切割多少下,使得切割后的每个 ...

  5. static面试总结

    static用法: 静态变量: 静态方法: 静态代码块: 静态内部类: 静态导包. 1.静态变量: private static int a = 0 2.静态方法: public static voi ...

  6. cf468B Two Sets

    Little X has n distinct integers: p1, p2, ..., pn. He wants to divide all of them into two sets A an ...

  7. mongo 操作符

    1 $unset The $unset operator deletes a particular field. https://docs.mongodb.com/manual/reference/o ...

  8. 洛谷 [P4035] 球形空间生成器

    高斯消元 注意浮点误差,判断一个浮点数是否为 0 的时候,看他的绝对值与 \(10^{-8}\)的关系 #include <iostream> #include <algorithm ...

  9. 【HDOJ5950】Recursive sequence(矩阵乘法,快速幂)

    题意:f[1]=a,f[2]=b,f[i]=2f[i-2]+f[i-1]+i^4(i>=3),多组询问求f[n]对2147493647取模 N,a,b < 2^31 思路:重点在于i^4的 ...

  10. Permission denied: user=administrator, access=WRITE, inode="/":root:supergroup:drwxr-xr-x

    参考博文:http://blog.csdn.net/xiaoshunzi111/article/details/52062640 http://www.udpwork.com/item/7047.ht ...