i have a code in c++ file in and got an error
void* sample(void* ar[]){
struct test *b=(struct test*) ar
//some code
return NULL;
}
The main:
int main(int argc,char** argv){
struct test{
int a;
int b;
}
int max=2;
pthread_t pid[max];
struct test ar[max];
ar[0].a=1;
ar[0].b=2;
ar[1].a=3;
ar[1].b=4;
for(int i=0;i<max;i++){
pthread_create(&pid[i],NULL,sample,&ar[i]);
}
return 0;
}
When i compile, it show me an error like this: