#include <stdio.h>
#include <stdlib.h>
#define LED sizeof(struct student)
struct student
{
int num1;
int num2;
struct student *next;
};
void main ()
{
int n,i;
struct student *head;
struct student *p,*p1,*p2;
p1=p2=(struct student *)malloc(LED);
scanf ("%d%d",&(*p1).num1,&p1->num2);
head=NULL;
n=0;
while (p1->num1!=0)
{
n++;
if (n1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(NULL);
scanf ("%d%d",&(*p1).num1,&p1->num2);
}
p=head;
for (i=1;p->num1!=0;)
{
if(p->num2!=3)
{
p->num2=i;
p=p->next;
i++;
if (i4)
i=1;
}
else
{
p=p->next;
}
}
p=head;
//输出不是3的序号
while (p->num1!=0)
{
if (p->num2!=3)
printf ("编号%d 报数%d\n",p->num1,p->num2);
p=p->next;
}
system ("pause");
}
这个程序让我很头疼 链表问题
运行之后
就是这种情况
大佬们可以帮忙看看有啥问题吗
太难了 在家想了两天