Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "void *(*)(void *)" mean in C++?

It's the parameter in pthread_create(). I think each part means:

  • void *: The return value is a void pointer.

  • (*): It's a pointer to a function.

  • (void *): It takes an untyped pointer as a parameter.

Is that correct?

like image 814
Marty Avatar asked Feb 21 '12 02:02

Marty


1 Answers

Yes, it is the signature of a nameless function pointer that takes and returns void *.

If it had a name (as in a variable) it would be:

void *(*myFuncName)(void*)
like image 182
Michael Chinen Avatar answered Sep 22 '22 03:09

Michael Chinen