User Tools

Site Tools


c:stdlib.h:abort

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:stdlib.h:abort [2013/01/22 22:02] (current)
Line 1: Line 1:
 +{{keywords>wiki library source code example reference}}
 +===== abort =====
 +
 +<code c>
 +    #include <stdlib.h>
 +    void abort(void);
 +</code>
 +Cause abnormal program termination, and try to catch SIGABRT. 
 +
 +no return value
 +    
 +===== C Sourcecode Example =====
 +<code c>
 +#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;
 +}
 +</code>
 +
 +==== 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 
 +
 +    
  
advertising
c/stdlib.h/abort.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum Datenschutz