I have a signal 11; i.e. segfault. I know where it occurs (see code), but do not know how to correct it.
int *totalThreadNumProduced; //array
int *totalThreadNumConsumed; //array
int *tempStats; //array
for(int i=0; i < global_args.numProducers; i++)
{
tempStats = (int*) pthread_join( tidP[i], NULL );
simulationStats.totalThreadNumProduced[i] = tempStats[0]; //where the segmentation fault 11 is
simulationStats.numTimesBufferFull += tempStats[1];
}