![](/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.