6.19.6 abort Function
Aborts the current process.
Include
<stdlib.h>
Prototype
void abort(void);
Remarks
When using MPLAB XC8 for PIC, the abort
function will ultimately call
_Exit()
. For all other compilers, abort()
cause
the processor to reset.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, y;
x = -2.0;
if(x < -1.0 || x > 1.0) {
printf("input out of range\n");
abort();
}
y = acos(x);
printf("the arc cosine of %g is %g\n", x, y);
}
Example Output
input out of range