【发布时间】:2013-07-16 10:22:44
【问题描述】:
void test(int x[static 10]);
int main()
{
int a[]={1,2,3,4,5,6,7,8,9,10,11};
test(a);
return 0;
}
void test(int x[static 10])
{
printf("%d",x[9]);
}
我一直在寻找奇怪的 C 语句。我找到了这个,但不明白static 10 在那个声明中有什么用。和int x[10]一样吗?
另外,您也可以使用volatile 代替static 例如int x[volatile 10]
有人知道这种声明有什么用吗?
PS:使用 GCC 4.6.3 编译,
【问题讨论】:
-
我以前见过这个问题。
-
请给个链接,发帖前我搜索过了。
-
@AkashShende stackoverflow.com/questions/3430315/…
-
@EricPetroelje 看来你的手指比我的快