【发布时间】:2012-12-29 01:32:31
【问题描述】:
我有一个这样的函数调用:
void foo(void *context) //function prototype
..
..
..
main()
{
.
.
foo(&(ptr->block)); //where ptr->block is of type integer.
.
.
.
void foo(void *context)
{
Here I try to use the ptr->block but am having problems. I have tried
if((int *)context ==1)
..
..
}
我在函数中将其类型转换回 int 以使用它。我在 foo() 函数中解引用错了吗?
【问题讨论】:
标签: c pointers void-pointers