Reputation: 143
I'm having trouble interpreting this sentence into code: A function called max_occurences() that has a pointer to an array of struct occurrences as an argument.
My understanding is that they mean something like this:
int max_occurences(struct occurrence *occurrences[])
But this appears to be wrong. Can someone help me understand what it's suppose to look like? I'm really confused.
Upvotes: 0
Views: 658
Reputation: 16607
int max_occurences(struct occurrence *occurrences[])
The argument here is array of pointers to struct occurrence
.
A pointer to an array of struct occurrence
would be declared as -
struct occurrence (*occurrences)[3];
So your argument should be -
int max_occurences(struct occurrence (*occurrences)[])
Upvotes: 1