two struct declaration with ( and ) in one line c programming

Viewed 46

hey im reading some code and I see this:

const struct struct_entry *(*enter)(const struct struct_entry *entry);

can you explain to me how can I dessect it ?

what I understand is it is creating two struct's one called enter and another entry am I right ?

1 Answers

... (*...)(...) is a function pointer.


There are three types here.

enter is a pointer to a function.

Its sole parameter entry is a pointer to a struct struct_entry, this struct being constant.

Its return value is a pointer to struct struct_entry, this struct being constant. (That const shouldn't be there.)


Some of the above was obtained by applying the Spiral Rule.

Related