I'm following this application by my book, and I tried to copy this program and see what it does.
With my big surprise I found that it doesn't work!!
The program is the following:
#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include <time.h>
#define TANTI 10
int parametroOUT;
void* codice(void *arg){
srand(time(NULL));
parametroOUT=(rand()%6)+1;
pthread_exit((void*)¶metroOUT);
}
int main(){
int dadoEstratto, *risultato=0;
pthread_t t1;
pthread_create(&t1,NULL,codice,NULL);
pthread_join(t1, (void*) &risultato);
printf("dado estratto: %d",*risultato);
return 0;
}
It returns an error at the line: pthread_join(t1, (void*) &risultato);
.
The error is:
[Error] invalid conversion from 'void*' to 'void**' [-fpermissive]
How can I fix this error?