![](/img/trans.png)
[英]Passing a pointer to an array of structs to a function for malloc
[英]Passing a pointer to an array of structs to a function
我在将这句话解释为代码时遇到麻烦:一个名为max_occurences()的函数,该函数具有一个指向结构出现数组的指针作为参数。
我的理解是,它们的含义如下:
int max_occurences(struct occurrence *occurrences[])
但这似乎是错误的。 有人可以帮助我了解它的外观吗? 我真的很困惑
int max_occurences(struct occurrence *occurrences[])
这里的参数是指向struct occurrence
的指针数组。
指向struct occurrence
数组的指针将声明为-
struct occurrence (*occurrences)[3];
因此,您的论点应该是-
int max_occurences(struct occurrence (*occurrences)[])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.