*head和*p都是指针,且有语句p=head;那么应该是指向指针的指针,为什么不能把*p改为**p?
#include<stdio.h>structst{intnum;floatscore;structst*next;};voidmain(){structsta,b,c,...
#include<stdio.h>
struct st
{
int num; float score;
struct st *next;
};
void main()
{
struct st a,b,c,*head,*p;
a.num=10101; a.score=89.5;
b.num=10103; b.score=90.0;
c.num=10107; c.score=85.0;
head=&a;
a.next=&b;
b.next=NULL;
p=head;
do
{
printf("%ld %5.1f\n",p->num,p->score);
p=p->next;
}
while(p!=NULL);
} 展开
struct st
{
int num; float score;
struct st *next;
};
void main()
{
struct st a,b,c,*head,*p;
a.num=10101; a.score=89.5;
b.num=10103; b.score=90.0;
c.num=10107; c.score=85.0;
head=&a;
a.next=&b;
b.next=NULL;
p=head;
do
{
printf("%ld %5.1f\n",p->num,p->score);
p=p->next;
}
while(p!=NULL);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询