#include <stdlib.h> #include <stdio.h> static void hw(void); main() { atexit(hw); } static void hw() { puts("Hello, world\n"); } Running this example produces the following output: Hello, world