summaryrefslogtreecommitdiff
path: root/reference/C/EXAMPLES/atexit.c
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/EXAMPLES/atexit.c')
-rw-r--r--reference/C/EXAMPLES/atexit.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/reference/C/EXAMPLES/atexit.c b/reference/C/EXAMPLES/atexit.c
new file mode 100644
index 0000000..2371f2f
--- /dev/null
+++ b/reference/C/EXAMPLES/atexit.c
@@ -0,0 +1,26 @@
+
+/******************************************************************
+ *
+ * Purpose: Program to demonstrate the use of atexit.
+ * Date: 17-Feb-97
+ * Author: M J Leslie.
+ * Descrip: Regester a function to be executed when a program normally
+ * terminates.
+ *
+ ******************************************************************/
+
+#include <stdlib.h>
+
+void End(void);
+
+main()
+{
+ atexit(End);
+
+ printf("Program is about to end\n");
+}
+
+void End(void)
+{
+ printf("Program ended\n");
+}