1. 程式人生 > >函式宣告定義使用的書寫格式

函式宣告定義使用的書寫格式

宣告:

int test(int ,char* )

int test(int a,char* s)

兩者都可以,但第一種比較常見。

定義:

int test(int a,char* s)

{

……

}

使用:

int a = test(int a,char* s)

PS:

在呼叫函式時,實參和形參可以使用相同的變數(如int a,int* a,int a[]),兩者互不衝突,互不影響。