我想知道 *& 是什么意思。 上下文:
一个函数实现如下:
void headInsert( Node*& head, int info )
{
Node* temp = new Node(info);
temp->link = head;
head = temp;
}
为什么不只使用 Node& 呢?
谢谢
最佳答案
Node*&
表示“对指向 Node 的指针的引用”,而 Node&
表示“对 Node 的引用”。
Why not just use Node& ?
因为 headInsert
函数需要改变 head 指向的地方。
关于c++ - *& 用于参数时是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27529522/