c語言abort函數(shù)實(shí)例用法
1、abort函數(shù)的作用是異常終止一個進(jìn)程,意味著abort后面的代碼將不再執(zhí)行。
2、當(dāng)調(diào)用abort函數(shù)時,會導(dǎo)致程序異常終止,而不會進(jìn)行一些常規(guī)的清除工作。
實(shí)例
#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.... */
實(shí)例擴(kuò)展:
/* name : abort function : 異常終止一個進(jìn)程 declare : void abort(void); include :#include <stdlib.h> explanation:abort函數(shù)是一個比較嚴(yán)重的函數(shù),當(dāng)調(diào)用它時,會導(dǎo)致程序異常終止,而不會進(jìn)行一些常規(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.... */
到此這篇關(guān)于c語言abort函數(shù)實(shí)例用法的文章就介紹到這了,更多相關(guān)c語言中abort函數(shù)的使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
C++實(shí)現(xiàn)快速排序(Quicksort)算法
這篇文章主要為大家詳細(xì)介紹了C++實(shí)現(xiàn)快速排序(Quicksort)算法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-04-04C語言編程簡單卻重要的數(shù)據(jù)結(jié)構(gòu)順序表全面講解
這篇文章主要為大家介紹了C語言編程中非常簡單卻又非常重要的數(shù)據(jù)結(jié)構(gòu)順序表的全面講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助2021-10-10實(shí)例詳解C/C++中extern關(guān)鍵字
這篇文章主要介紹了C/C++中extern關(guān)鍵字詳解 的相關(guān)資料,需要的朋友可以參考下2016-04-04