the error message means the following:
"cannot convert a function pointer for a function that takes in an int and returns a void to a function pointer that takes in a void* and returns a void*".
this code compiles fine.
Code:
#include <pthread.h>
void *Car(void *arg)
{
return NULL;
}
int main()
{
pthread_t cars[5];
int i = 0;
// your call
pthread_create(&cars[i],NULL,Car, (void *) i);
return 0;
}
this code generates your error:
Code:
#include <pthread.h>
void Car(int arg)
{
}
int main()
{
pthread_t cars[5];
int i = 0;
// your call
pthread_create(&cars[i],NULL,Car, (void *) i);
return 0;
}
p.c: In function `int main()':
p.c:13: invalid conversion from `void (*)(int)' to `void*(*)(void*)'
have a look at Car again, something is strange about it (maybe you have a prototype in a header file that doesn't match the body).
btw, there is nothing wrong with "(void *)i" if you intend to have a pointer who's value is i (i'm guessing your Car function will take this value and convert it back into an int).