The abort function causes abnormal program termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return.
Any open streams are flushed and closed.
Example:
Example - Cause abnormal program termination
Workings
#include <stdlib.h>int main(){int a = 2;
abort();
// this will never execute
a = 3;
return0;
}
Implementation Notes
The abort function is thread-safe. It is unknown if it is async-cancel-safe.