ソースコード源文件
| ||||
---|---|---|---|---|
実行結果
プロトタイプ宣言は、 int showarray(int *); となっていますが、実際の関数は int showarray(int x[]) となっています。要するに、引数がint型へのポインタであるということがわかればよいのです。プロトタイプ宣言に int showarray(int x[]); とか int showarray(int x[3]); と買いても問題ありません。関数側についても int showarray(int x[]) int showarray(int x[3]) int showarray(int *x) などの書き方があります。この場合も添字の3は無視されます。 もう少し複雑の例を見てみましょう。
|