小编use*_*682的帖子

你如何声明引用指针?

main()
{
 int *a; 
 myfunc(a);
}

myfunc(int & *b)
{
 //'b' is a pointer with the same address as 'a'
 //so if you change what 'b' points to, it also changes what 'a' points to
}
Run Code Online (Sandbox Code Playgroud)

以上是行不通的。现在这没什么大不了的,因为你可以使用双指针来做同样的事情,拥有引用指针似乎更简单。

main()
{
 int *a;
 myfunc(&a)
}

myfunc(int **b)
{
 //de-referencing b once will give you the 'a' pointer
}
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
183
查看次数

标签 统计

c++ ×1