问个关于链表的小问题
#include<iostream>
using namespace std;
typedef struct LNode
{
int data;
struct LNode *next;
}*LinkNode,LNode;
class LinkedList
{
public:
LNode L;
int LLength;
LinkedList();
LNode LinkedListInit(); //初始化
};
LinkedList::LinkedList()
{
L=NULL;
LLength=0;
}
LNode LinkedList::LinkedListInit()
{
L=new LNode;
L->next=NULL;
return L;
}
int main()
{
LNode L= LinkedList lb;
lb.LinkedListInit();
return 0;
}
以下错误..
E:\c++练习\顺序表链表\链表操作.cpp(30) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'const int' (or there is no acceptable conversion)
E:\c++练习\顺序表链表\链表操作.cpp(37) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'struct LNode *' (or there is no acceptable conversion)
E:\c++练习\顺序表链表\链表操作.cpp(38) : error C2819: type 'LNode' does not have an overloaded member 'operator ->'
E:\c++练习\顺序表链表\链表操作.cpp(5) : see declaration of 'LNode'
E:\c++练习\顺序表链表\链表操作.cpp(38) : error C2227: left of '->next' must point to class/struct/union
Error executing cl.exe.