有人可以告诉检查链表大小的代码是什么(节点数)。这就是我的代码(插入和删除所有节点的头+信息)C++函数链表大小
struct node
{
int info;
node *nextptr;
};
class list
{
private:
node *L,*tail;
int count;
public:
list()
{
L=tail=NULL;
count=0;
}
void InsertHead(int info);
int RemoveHead();
void Print();
};
为'count'创建一个getter? – NullUserException 2010-10-13 23:46:32
你必须给我们更多的信息 - 函数的实现是什么?此外,你有什么尝试,你有什么具体的麻烦? – Eclipse 2010-10-13 23:47:23