for(i=0;i<N;i++)
{
pfirst=(pdate)malloc(sizeof(tdate));//创建新节点
pfirst->month=cr[i].month;
pfirst->day=cr[i].day;
pfirst->year=cr[i].year;
pfirst->next=NULL; //新节点下一个节点赋值为空1
psecond->next=pfirst;//pSecond->next=新节点2
psecond=pfirst;//pSecond=新节点3
1 2 3 不觉得矛盾么
}
void prnlist(pdate head)
{
pdate pfirst=head->next;//遍历你每次从第二个节点开始遍历
while(pfirst!=NULL)
{
printf("%6u%4u%4u\n",pfirst->year,pfirst->month,pfirst->day);
pfirst=pfirst->next;
}
}
{
pfirst=(pdate)malloc(sizeof(tdate));//创建新节点
pfirst->month=cr[i].month;
pfirst->day=cr[i].day;
pfirst->year=cr[i].year;
pfirst->next=NULL; //新节点下一个节点赋值为空1
psecond->next=pfirst;//pSecond->next=新节点2
psecond=pfirst;//pSecond=新节点3
1 2 3 不觉得矛盾么
}
void prnlist(pdate head)
{
pdate pfirst=head->next;//遍历你每次从第二个节点开始遍历
while(pfirst!=NULL)
{
printf("%6u%4u%4u\n",pfirst->year,pfirst->month,pfirst->day);
pfirst=pfirst->next;
}
}
[此贴子已经被作者于2017-3-21 19:52编辑过]