For each cell, I want to create a thread that will multiply its current row number by its current column number. The problem is that I don't know how to properly dereference the matrix and use it. Valgrind says that there is an uninitialized value of size 8 used in fillcell. Since it's size 8 I suspect it is the pointer. How can I properly convert it?
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include "myutils.h"
int i = 10;
int j = 10;
int var = 0;
int w,x;
void * fillcell(void * param){
int** value = (int**) param;
value[x][w]= x*w;
printf("%d \n",w*x);
}
int main(int argc, char * argv[])
{
pthread_t * tid;
tid = malloc(i*j*sizeof(pthread_t));
int A[i][j];
for ( x = 0; x < i; x++){
for( w = 0; w < j; w++){
pthread_create(&tid[var],NULL , fillcell,&A);
pthread_join(tid[var],NULL);
var++:
}
}
free(tid);
}