atoi函数的使用实例:【Ubuntu环境】
main.c:
1 #include <stdio.h> 2 #include <stdlib.h> 3 extern int factorial(int f); //external function:如果写extern是显式的外部声明;不写也对,只是隐式的而已 4 5 int main(int argc, char ** argv) 6 { 7 int t; 8 if(argc < 2) 9 { 10 printf("The format of the input: %s number\n", argv[0]); 11 return -1; 12 } 13 else 14 { 15 t = atoi(argv[1]); 16 printf("%d! is %d.\n", t, factorial(t)); 17 } 18 return 0; 19 }