typedef int MHF;
typedef struct LNode
{
char quming[20];
char zuozhe[20];
char geshou[20];
MHF nian;
MHF yue;
MHF ri;
struct LNode *next;
}LNode, *LinkList;
int listinsert(LinkList &L, int i, char *quming, char *zuozhe, char *geshou, MHF &nian, MHF &yue, MHF &ri)
{
if (i < 1) return 0;
int j = 0;
LinkList p = L,s;
while ((j < i - 1) && p != NULL)
{
p = p->next;
j++;
}
if (p == NULL)
return 0;
else
{
s = new LNode;
if (s == NULL)
{
cout << "结点分配失败\n";
return 0;
}
s->quming = quming;
cout << quming << endl;
cout << s->quming << endl;
s->geshou = geshou;
cout << geshou << endl;
cout << s->geshou << endl;
s->zuozhe = zuozhe;
cout << zuozhe << endl;
cout << s->zuozhe << endl;
s->nian = nian;
s->yue = yue;
s->ri = ri;
s->next = p->next;
p->next = s;
return 1;
}
}
s报错,说表达式必须为可修改的左值,这是为什么???
望远