0

I'm not sure if I said it right.

   pthread_create(..., ..., &some, ...);
   ...is the same as:
   pthread_create(..., ..., some, ...);

I'm learning threads, if you could give a website or a video that makes it really simple, it would be great. Threads - locks, condition variables, etc. Thanks!

SadSeven
  • 1,247
  • 1
  • 13
  • 20

2 Answers2

2

Yes because function name is pointing to a memory location. In simple words it is a memory address, so you pass it like foo or &foo, both are the same.

Example Code:

#include <stdio.h>

int foo(){

    printf("hello world");

}

int (*fuu)();

int main (void)
{
   fuu = foo;
   fuu();

    return 0;
}

Hope this helps

Umer Farooq
  • 7,356
  • 7
  • 42
  • 67
1

You can use both function name some or pointer to function &some to get the address of the function.

Check also this answer.

Community
  • 1
  • 1
nio
  • 5,141
  • 2
  • 24
  • 35