行逻辑链接的顺序表操作课程设计(C语言版),急用,各位高手帮帮忙!谢谢了!

来源:百度知道 编辑:UC知道 时间:2024/06/16 19:34:37
谢谢你了,可是我需要的是顺序表操作了

有链式的没有顺序的呀。。。。

链式如下:
#include<stdio.h>
typedef struct linknode
{char data;
struct linknode *next;
}node;
node *head;
int n=0;
void CreateList()
{
node *p,*s;
char x;
int z=1;
head=(node *)malloc(sizeof(node));
p=head;
printf("\n\t\tjian li yi ge xian xing biao ");
printf("\n\t\t shuo ming:qing zhuge shu ru zi fu,biao ji wei“x”!\n");
while(z)
{
printf("\t\t shu ru : ");
scanf("%c",&x);
getchar();
if(x!='x')
{
s=(node *)malloc(sizeof(node));
n++;
s->data=x;
p->next=NULL;
p=s;
}
else z=0;
}
}
void InsList(int i,char x)
{
node *s,*p;
int j;
s=(node *)malloc(sizeof(node));
n++;
s->data=x;
if(i==0)
{
s->n