void exit(int status);
Parameter:
status: mã exit
Remark:
Hàm exit( ) kết thúc chương trình đang chạy. Khác với hàm abort, hàm exit không show error dialog.
- status là 0 để chỉ hàm kết thúc bình thường
- status khác 0 để chỉ hàm kết thúc bất thường.
Ví dụ:
#include "stdio.h" #include "conio.h" #include "stdlib.h" void main( void ) { int a = 9, b = 0; if(b == 0) exit(1); else printf("\na/b = %d/%d = %f", a, b, (float)a/b); getch(); }
Leave a Reply
You must be logged in to post a comment.