struct val *v = (struct val *)arg;//传入的结构体指针强制转为实例化结构体*v
struct val{ int num1; int num2; };
void *text3(void *arg) { struct val *v = (struct val *)arg; int num3=v—>num1; int num4=v->num2; printf("arg is v.num1:%d,v.num2:%d\n",num3,num4); // printf("arg is v.num1:%d,v.num2:%d\n",v->num1,v->num2); pthread_exit(NULL);}例子:=======>>>>【C】——如何用线程进行参数的传递;
时间: 2024-12-20 01:06:32