abort() - Utility Function
How is Utility function "abort()" used in C++?
How to Abort the program using c++?
Explanation
abort() is a Utility Function that abort(terminate) the program execution immediately. It will return an implementation defined value to the calling process, in environments that support this function otherwise never returns to the calling program.
Syntax:
void abort(void);
Example :
#include <stdlib.h> #include <stdio.h> int main() { printf("The program will get aborted"); abort(); } |
Result :
The program will get aborted
Abnormal program termination
In the above example abort() terminates the program and returns an implementation defined value.