[英]Pointer vs Array in function definition: what is the difference between void fct1(int *p) and void fct1(int p[])?
i wanna know what is the difference between 我想知道它们之间有什么区别
void fct1(int *p)
and 和
void fct1(int p[])
i know that both are pointers but are there any differences 我知道这两个都是指针,但有任何差异
There is absolutely no difference when used as a function parameter like that. 当用作这样的函数参数时绝对没有区别。 The compiler treats both forms identically. 编译器以相同的方式处理两种形式。
There is no difference. 没有区别。 For completeness, here's what the standard says: 为了完整起见,这是标准所说的:
C99 standard 6.7.5.3 section 7 C99标准6.7.5.3第7节
A declaration of a parameter as ''array of type '' shall be adjusted to ''qualified pointer to type '', ... 参数声明为''数组类型 ''应调整为''限定指向类型 '',...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.