c語言abort函數(shù)實例用法
更新時間:2021年09月29日 08:29:07 投稿:laozhang
在本篇文章里小編給大家整理了一篇關于c語言abort函數(shù)實例用法及相關知識點,有興趣的朋友們可以學習下。
1、abort函數(shù)的作用是異常終止一個進程,意味著abort后面的代碼將不再執(zhí)行。
2、當調(diào)用abort函數(shù)時,會導致程序異常終止,而不會進行一些常規(guī)的清除工作。
實例
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
puts( "About to abort..../n" );
abort();
puts( "This will never be executed!/n" );
exit( EXIT_SUCCESS );
}
/*
輸出:
About to abort....
*/
實例擴展:
/*
name : abort
function : 異常終止一個進程
declare : void abort(void);
include :#include <stdlib.h>
explanation:abort函數(shù)是一個比較嚴重的函數(shù),當調(diào)用它時,會導致程序異常終止,而不會進行一些常規(guī)的清除工作,比如釋放內(nèi)存等。
*/
//example:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
puts( "About to abort..../n" );
abort();
puts( "This will never be executed!/n" );
exit( EXIT_SUCCESS );
}
/*
result:
[root@localhost error_process]# gcc abort.c
[root@localhost error_process]# ./a.out
About to abort....
*/
到此這篇關于c語言abort函數(shù)實例用法的文章就介紹到這了,更多相關c語言中abort函數(shù)的使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
C語言編程簡單卻重要的數(shù)據(jù)結(jié)構(gòu)順序表全面講解
這篇文章主要為大家介紹了C語言編程中非常簡單卻又非常重要的數(shù)據(jù)結(jié)構(gòu)順序表的全面講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助2021-10-10

