【发布时间】:2016-11-19 23:30:28
【问题描述】:
我不熟悉描述*((int *) arg) 的术语,因此我无法成功地通过谷歌查询该主题以了解更多信息;我也没有成功在这里找到任何东西。
这是来自The Linux Programming Interface的代码片段:
static void *threadFunc(void *arg)
{
int loops = *((int *) arg)
...
}
int main(int argc, char *argv[])
{
pthread_t t1;
int loops, s;
loops = (argc > 1) ? getInt(argv[1], GN_GT_0, "num-loops") : 10000000;
s = pthread_create(&t1, NULL, threadFunc, &loops);
...
}
int loops = *((int *) arg) 在做什么?这种现象叫什么?谢谢。
【问题讨论】:
-
您将
void*转换为int*然后取消引用它?
标签: c pointers casting type-conversion