#include <stdio.h> int age(int n);//外部聲明 int main() { printf("age=%d\n",age(5));//age=18--遞歸-輸出第五個學生的年齡 return 0; } int age(int n) { //在調用一個函數的過程當中又出現直接或者間接的調用該函數自己,稱爲遞歸調用 int c; if (n==1) { c=10; }else{ c=age(n-1)+2;//函數名字age在函數age內部出現就是遞歸調用 } return c; }