What is abort in c Programming?

abort function in c abnormally terminates the program. This function may not closes the files that are opened by the currently executing the program.

It raises SIGABRT signal to terminate the process.

It indicates the unsuccessful termination of a program.

This function is defined in stdlib.h header file.


void abort(void);

Return value

This function does not returns any value.

Example Program for abort()

int main()
  int a,b;
  printf("enter the values of a and b in (a/b) format \n");
    printf("denominator cannot be zero \n");
  printf("The result is %d\n",res);
  return 0;


enter the values of a and b in (a/b) format 



denominator cannot be zero
abort function in c output
abort function in c output

Code Explanation

abort() terminates the program immediately if it finds that denominator value is zero.

People Also Ask for

What causes abnormal termination of a program?

The abort function terminates the program abnormally.

What is abnormal program termination?

In abnormal program termination, the abort function does not return any value to the main function.