1. 程式人生 > >傳入的結構體指針強制轉為實例化結構體*v

傳入的結構體指針強制轉為實例化結構體*v

_exit class pri truct title href www str 結構體

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】——如何用線程進行參數的傳遞;

傳入的結構體指針強制轉為實例化結構體*v