基础差专用版适用学习基础薄弱者,若无头绪,请翻阅吾历史博客汝必窃喜
具体就是如何创建一个顺序表然后实现各种功能。
需要使用的知识:指针 顺序表类型 数组 !
#include<stdio.h>
#include<malloc.h>
#define MaxSize 50
typedef char ElemType;
typedef struct
{
ElemType data[MaxSize];//ElemType 类型的data数组也就是char 类型的数组
int length;
}SqList;
void InitList(SqList *&L)
{
L=(SqList*)malloc(sizeof(SqList));
L->length=0;
}
void DestroyList(SqList *L)
{
free(L);
}
bool ListEmpty(SqList *L)
{
return (L->length==0);
}
int ListLength(SqList *L)
{
return(L->length);
}
void DispList(SqList *L)
{
for(int i=0;i<L->length;i++)
printf("%c",L->data[i]);
printf("\n");
}
bool GetElem(SqList *L,