一个关于数据结构的问题 Change() 急~~!!~~
#include <iostream>using namespace std;
struct celltype {
int element;
celltype * next; };
typedef celltype * position;
typedef celltype * LIST;
celltype * End(LIST & L) {
celltype * q;
q = L;
while (q->next != NULL)
q = q->next;
return q; }
void MakeNull (LIST &L) {
L = new celltype;
L->next = NULL; }
void Insert (int x,position p) {
position temp;
temp = p->next;
p->next = new celltype;
p->next->next = temp;
p->next->element = x; }
void Change(position p,LIST & L) {
position temp,temp2;
temp = p->next->next->next;
temp2 = p->next->next;
p->next->next->next = p->next;
p->next->next = temp;
p->next = temp2; }
int main() {
celltype * L= new celltype;
Insert(1,L);
Insert(2,L);
Insert(3,L);
Change(2,L);
return 0;
}
我在运行的时候,Eclipse显示initializing argument 1 of `void Change(celltype*, celltype*&)'
c++上显示C:\Documents and Settings\Administrator\桌面\新建文件夹\gaohao.cpp(36) : error C2664: 'Change' : cannot convert parameter 1 from 'const int' to 'struct celltype *'
怎么办?