github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/tests/stdlib_atexit.c (about) 1 /* atexit example */ 2 #include "tests.h" 3 #include <stdio.h> 4 #include <stdlib.h> /* atexit */ 5 6 int r_value = 3; 7 8 void fnExit1(void) 9 { 10 r_value += 2; 11 } 12 13 void fnExit2(void) 14 { 15 r_value *= 5; 16 } 17 18 void done(void) 19 { 20 printf("%d\n", r_value); 21 } 22 23 int main() 24 { 25 plan(0); 26 atexit(done); 27 atexit(fnExit1); 28 atexit(fnExit2); 29 done_testing(); 30 }