Hi, I am trying to increment the pointer I send when creating a pthread but it doesn't compile. The increment is at line 30, its written in C. How can I get this to work?
Main:
1 2 3 4 5 6
//create all producers
for (i = 0; i < nproducers; i++)
{
pcount[i] = 0;
pthread_create (&tid_produce[i], NULL, producer, &pcount[i]);
}
You can't dereference a void pointer. If pcount[i] is an int you have to cast the pointer to an int pointer before dereferencing it. (*(int*) param)++;