使用纯C退出程序 [英] Quiting a program using pure C

查看:383
本文介绍了使用纯C退出程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否还有使用纯C语言退出程序的方法

而不是返回0?

解决方案

"君麻吕" <李************ @ yahoo.com>写道:

使用纯C语言退出程序是否还有其他方法
除了返回0?




有一种方法:

退出(0);


这个函数,我认为它在stdlib.h中被deklared完成你的程序,

但要注意记忆泄漏。


亲切的问候,

Nicolas


-

| Nicolas Pavlidis | Elvis Presly:| \ | __ |

| SE& s的学生KM | 进入goto | \ | __ | |

| pa****@sbox.tugraz.at | ICQ#320057056 | |

| -------------------格拉茨技术大学---------------- |




" kimimaro" <李************ @ yahoo.com>在消息中写道

新闻:ca ****************************** @ localhost.ta lkaboutprogramming。 com ...

使用纯C语言退出程序是否还有其他方法
除了返回0?




you还可以有

返回EXIT_FAILURE;

返回EXIT_SUCCESS;


,详见< stdlib.h>


- Ravi




" Nicolas Pavlidis" < PA **** @ sbox.tugraz.at>在消息中写道

新闻:2v ************* @ uni-berlin.de ...

" kimimaro" <李************ @ yahoo.com>写道:

除了返回0之外,是否还有使用纯C语言退出程序的方法?



有一个方式:
退出(0);

这个函数,我认为它在stdlib.h中被deklared完成你的程序,
但要注意memoryleaks。




大多数* OS'在程序退出时释放内存所以它不是真正的内存泄漏问题,而是编程风格。


*我所知道的全部。


Is there anymore methods in exiting your program using pure C language
other than return 0?

解决方案

"kimimaro" <li************@yahoo.com> writes:

Is there anymore methods in exiting your program using pure C language
other than return 0?



There is a way:
exit(0);

This function, I think it is deklared in stdlib.h finishes your program,
but be aware of memoryleaks.

Kind regards,
Nicolas

--
| Nicolas Pavlidis | Elvis Presly: |\ |__ |
| Student of SE & KM | "Into the goto" | \|__| |
| pa****@sbox.tugraz.at | ICQ #320057056 | |
|-------------------University of Technology, Graz----------------|



"kimimaro" <li************@yahoo.com> wrote in message
news:ca******************************@localhost.ta lkaboutprogramming.com...

Is there anymore methods in exiting your program using pure C language
other than return 0?



you can also have
return EXIT_FAILURE;
return EXIT_SUCCESS;

as defined in <stdlib.h>

- Ravi



"Nicolas Pavlidis" <pa****@sbox.tugraz.at> wrote in message
news:2v*************@uni-berlin.de...

"kimimaro" <li************@yahoo.com> writes:

Is there anymore methods in exiting your program using pure C language
other than return 0?



There is a way:
exit(0);

This function, I think it is deklared in stdlib.h finishes your program,
but be aware of memoryleaks.



Most* OS''s free the memory when a program has exited so it''s not really a
concern over memory leaks, but rather on programming style.

*All that I know of.


这篇关于使用纯C退出程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆