问题是当第二次我把任何单词q-> ch在if语句中改为新单词时 ..我希望q成为链表开头的指针
while(true){
tmp=(list*)malloc(sizeof(list));
printf("\n put any word:");
scanf("%s",name);
printf("\n");
tmp->ch=name;
if (i==0)
{
q=p=tmp;
}
else
{
p->nxt=tmp;
p=tmp;
}
printf("when you want to end press y \n");
scanf(" %c",&c);
if (c=='Y' || c=='y')
{
break;
}
i++;
}