我在读C 编程:现代方法通过 K.N.King 学习 C 编程语言,当前章节介绍了函数以及数组参数。据解释,可以使用如下结构来表示数组参数的长度:
1.
void myfunc(int a, int b, int[a], int[b], int[*]); /* prototype */
void myfunc(int a, int b, int n[a], int m[b], int c[a+b+other_func()]) {
... /* body */
}
2.
void myfunc(int[static 5]); /* prototype */
void myfunc(int a[static 5]) {
... /* body */
}
所以问题是:
a.示例 1 中的构造纯粹是装饰性的还是对编译器有影响?
b. Is the static
在这种情况下修饰符仅具有装饰性?它到底是什么意思和作用?
c.是否也可以这样声明数组参数;它是否像示例 1 一样美观?
void myfunc(int[4]);
void myfunc(int a[4]) { ... }