退出函数

  1. # include <stdio.h>
  2. main()
  3. {
  4. printf("hello, world\n");
  5. }

打印终止状态

  1. # gcc hello\ world.c
  2. #./a.out
  3. hello, world
  4. # echo $?
  5. 13

启动C99扩展

  1. # gcc -std=c99 hello\ world.c
  2. hello world.c:3:1: warning: return type defaults to int [enabled by default]
  3. main()
  4. ^
  5. # ./a.out
  6. hello, world
  7. # echo $?
  8. 0

函数atexit