User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdlib.h:abort

abort

    #include <stdlib.h>
    void abort(void);

Cause abnormal program termination, and try to catch SIGABRT.

no return value

C Sourcecode Example

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 /* for printf */
#include <stdlib.h>
int main( void )
{
  int x=2,y=5,i;
  i=x+y;
 
  printf("x = %i | y = %i\n", x, y);
 
  abort();
 
  /* will never execute, abort will terminate the programm */
  printf("result of %i+%i= %i", x, y, i);
 
  return 0;
}

output with abort:

  user@host:~/code-reference.com# ./abort
  x = 2 | y = 5
  aborted

output without abort

  user@host:~/code-reference.com# ./abort
  x = 2 | y = 5
  result of 2+5= 7 

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/stdlib.h/abort.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz