困扰我一星期的数据链表的问题
困扰我一星期的数据链表的问题源码如下:
#include <stdlib.h>
#include <stdio.h>
struct node
{
int d[5];
struct node *next;
};
struct node *lookst(struct node *head,int x) //²éÕÒ
{
struct node *p;
p=head;
while((p->next!=NULL)&&((p->next)->d[5])!=x)p=p->next;
return(p);
}
inslst(struct node **head,int x,int b) //²åÈë
{
struct node *p,*q ;
p=(struct node *)malloc(sizeof(struct node));
p->d[5]=b;
if(*head==NULL)
{
*head=p;
p->next=NULL;
return 0;
}
if((*head->d[5])==x)
{
p->next=*head;
*head=p;
return 0;
}
q=lookst(*head,x);
p->next=q->next;
q->next=p;
return 0;
}
delst(struct node **head,int x)
{
struct node *p,*q;
if(*head==NULL)
{
printf("This is a empty list !\n");
return 0;
}
if((*head->d[5])==x)
{
p=*head->next;
free(*head);
*head=p;
return 0;
}
q=lookst(*head,x);
if(q->next==NULL)
{
printf("No this node in the list!\n");
return 0;
}
p=q->next;q->next=p->next;
free(p);
return 0;
}
main()
{
int i,n,d[5];
struct node *m;
printf("the input number:\n");
for(i=0;i<5;i++)
scanf("%d",&d[i]);
printf("\n");
printf("please input the insert number:\n");
scanf("%d",&n);
lookst(m,4);
inslst(&m,3,5);
for(i=0;i<6;i++)
printf("%d",&d[i]);
delst(&m,5);
for(i=0;i<6;i++)
printf("%d",&d[i]);
}
以上程序编译报错:
C:\Documents and Settings\dell\×ÀÃæ\data\4.c(29) : error C2223: left of '->d' must point to struct/union
C:\Documents and Settings\dell\×ÀÃæ\data\4.c(49) : error C2223: left of '->d' must point to struct/union
C:\Documents and Settings\dell\×ÀÃæ\data\4.c(51) : error C2223: left of '->next' must point to struct/union
不知如何解决,希望高人指点哈!