【发布时间】:2012-11-09 22:23:15
【问题描述】:
首先。感谢各位的帮助!
这是问题所在。尝试将列表的边缘之一设置为空
list[i].getAttachedNode(j) = 0;
这是错误。
Prj3.cpp:165:34: error: lvalue required as left operand of assignment
这是我的清单声明。
Node list[47];
这是附加节点的实现。
Node* Node::getAttachedNode(int direction) {return attachedNode[direction];}
[b]这是它所在的块。
for(int i = 0; i<48; i++)
{
for(int j = 0; j<6; j++)
{
string info = g.returnInfo(i,j);
switch(j)
{
case 0:
list[i].setNodeName(info);
break;
case 1:
if(info.compare(null) == 0)
{list[i].getAttachedNode(j) = 0;}
break;
}
}
}
【问题讨论】:
-
你应该返回一个
Node*&。 -
让我看看list的声明
-
@SethCarnegie:你应该这样回答......
标签: c++ linked-list nodes