December 2005
Beginner to intermediate
618 pages
20h 19m
English
abort
Ends program execution immediately
#include <stdlib.h>
voidabort( void );The abort() function
terminates execution of a program by raising the SIGABRT signal.
For a “clean” program termination, use the exit() function. abort() does not flush the buffers of open
files or call any cleanup functions that you have installed using
atexit(). The abort() function generally prints a
message such as:
Abnormal program termination
on the stderr stream. In
Unix, aborting a program also produces a core dump.
struct record { long id;
int data[256];
struct record *next;
};
/* ... */
struct record *new = (struct record *)malloc( sizeof(struct record) );
if ( new == NULL ) // Check whether malloc failed!
{
fprintf( stderr, "%s: out of memory!", _ _func_ _ );abort();
}
else /* ... */Read now
Unlock full access