c - C99 中的哪一节说数组在 C 中没有复制地传递给函数?

标签 c arguments c99

我最近注意到

void foo(int array[10]); 

调用foo 时不会将数组的内容加载到堆栈中,因此声明等同于:

void foo(int *array):

我想在 C99 标准中找到断言此行为的部分,但我没有找到任何内容,或者我不知道应该搜索什么。到目前为止,我尝试了by referenceby valuefunction callpassing arguments、...

最佳答案

C11 6.7.6.3 §7。 (C99 6.7.5.3 §7)

A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation.

该术语正式命名为“数组调整”。在 C 标准之外,它通常被非正式地称为“数组衰减”。

关于c - C99 中的哪一节说数组在 C 中没有复制地传递给函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49515956/

相关文章:

c++ - C/C++ 中 void main 和 int main 的区别?

javascript - 从头开始编码 JS Underscore _.extend

android - Android 的构建时间参数

jquery - 如何从函数参数创建变量名

c - C中 `inline`关键字有什么用?

c++ - 如何在固定宽度类型上强制执行无符号算术?

控制台输出未对齐

c - 自动使用fgets()测试程序

c - 整数除法的行为是什么?

c - 给定一个矩阵,找出行数和列数