Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to understand that function / pointer declaration?

In C, one can declare pointers to functions like that:

void (*Func1)(int)

I believe that I’ve understood what this means (in this case, a pointer to a function which returns void and takes an int as parameter) and how to declare and use such pointers.

However, I now have come across declarations like the following:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

void (*Func2(int, int))(int)

I am struggling with understanding this syntax. What exactly is declared here? Probably it is a pointer to a function, but I always thought that the closing round parenthesis after the pointer’s name is necessary then, so I am completely unsure now.

Could anybody explain, step by step, what the above declaration means?

>Solution :

From https://cdecl.org/?q=void+%28*Func2%28int%2C+int%29%29%28int%29

void (*Func2(int, int))(int)

declare Func2 as function (int, int) returning pointer to function (int) returning void

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading