相关疑难解决方法(0)

static char关键字在函数数组参数中的用途如"char s [static 10]"?

在浏览一些源代码时,我遇到了这样的函数:

void someFunction(char someArray[static 100])
{
    // do something cool here
}
Run Code Online (Sandbox Code Playgroud)

通过一些实验,似乎其他限定符也可能出现在那里:

void someFunction(char someArray[const])
{
    // do something cool here
}
Run Code Online (Sandbox Code Playgroud)

似乎只有[ ]在将数组声明为函数的参数时才允许使用限定符.这些怎么办?为什么功能参数不同?

c arrays parameters static

131
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

c ×1

parameters ×1

static ×1