我正在尝试创建一个队列链接,并且正在传递链接引用的引用,并且它没有工作并给出错误。使用引用无法正常工作的遍历链接列表
在函数'void insertDataToQueue(Node **,int)'中: 请求'* temp'中的成员'next',它的指针类型为'Node * {aka node *}'(也许你打算使用' - >'?
void insertDataToQueue(Node **queueList, int burstTime){
Node *newNode = new Node;
newNode->burstTime = burstTime;
newNode->next = NULL;
if(queueList == NULL){
*queueList = newNode;
}
else{
Node **temp = queueList;
while(*temp != NULL)
temp = *temp->next;
}
}
成员访问比解除引用具有更高的优先权,请参阅[这里](http://en.cppreference.com/w/cpp/language/operator_precedence) – user463035818
那么我该如何遍历这个列表? –
为了什么目的你正在写一个数据结构(它已经存在于'namespace std'中)? – Caleth