User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdlib.h:atexit

atexit

    #include <stdlib.h>
    int atexit(void (*func)(void));
 

Description

       The atexit function registers the given function to be called at normal
       process termination
 
       atexit returns the value 0 if successful, otherwise it returns
       a nonzero value.

C Sourcecode Example

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <stdlib.h>
 
void ExitMessage( void )
{
  printf("atexit was called, this is the exit message\n");
}
 
int main( void )
{
  atexit(ExitMessage);
 
  printf("The ExitMessage will shown after this line\n");
 
  return 0;
}

output

  user@host:~/code-reference.com#  ./atexit 
  The ExitMessage will shown after this line
  atexit was called, this is the exit message

on the occasion of the current invasion of Russia in Ukraine

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

Impressum Datenschutz