C语言底子不好真可怕,又来求助啊
这是我写的代码,目的是删除顺序表中的x并输出删除后的单链表。我知道里面有很多错误。又要麻烦大家了。。。。给我指点下下吧。。。指出错误,建议什么的,我很需要嗯
#include <stdio.h>
#define MAX 100
typedef struct node
{
int data[MAX];
struct node *palist;
int length;
}seqlist,*pseqlist;
void creat(pseqlist palist,int n )
{
printf("输入建立%d个数据的线性表!\n",n);
for(int k = 0;k < n;k ++)
{
scanf("%d",&palist ->data[k]);
}
palist ->length = n;
}
int deleveV_seq(pseqlist palist,int x)
{
int i,j;
for(i =0;i <= palist -> length-1;)
if(x == palist ->data[i])
{
for (j = i;j <= palist ->length - 1;)
{
palist ->data[j] = palist ->data[j+1];
}
palist ->length --; //= palist ->length - 1;
return 1;
}
else
{
j ++;
}
return 0;
}
void print(pseqlist palist)
{
int i;
for (i = 0;i <= palist ->length-1;i ++)
{
printf("%d ",palist ->data[i]);
}
}
void main()
{
pseqlist p;
creat(p,10);
print(p);
printf("\n\n");
deleveV_seq(p,3);
print(p);
}