I am trying to pass a 2d array into a pthread function, but I can not find a way to get access to the array content during pthread process, how can I do it? I tried
int ** array = (int **)arg;
but it caused segfault after I tried to change the stored value; Here is part of my code:
int message1[2][64];
int i = 0;
for (; i < 2; i++)
{
int j = 0;
for (; j < 64; j++)
{
message[i][j] = 1;
}
}
pthread_t tid[1];
pthread_create(&tid[0], NULL, xD, message);
the function:
void * xD(void * arg)
{
int ** array = (int **)arg;
array[0][0] = 2;
}