//c语言实现串的块链存储表示
//杨鑫
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CHUNKSIZE 80
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
char blank='#';
typedef int Status;
//定义块链存储的串的每个节点
typedef struct Chunk
{
char ch[CHUNKSIZE];
struct Chunk *next;
}Chunk;
//定义块链存储的串
typedef struct
{
Chunk *head, *tail;
int curlen;
}LString;
void InitString(LString *T)
{
(*T).curlen=0;
(*T).head=NULL;
(*T).tail=NULL;
}
Status StrAssign(LString *T,char *chars)
{
int i,j,k,l;
Chunk *p,*q;
i=strlen(chars);
if(!i||strchr(chars,blank))
return ERROR;
(*T).curlen=i;
j=i/CHUNKSIZE;
if(i%CHUNKSIZE)
j++;
for(k=0;k<
数据结构之---C语言实现串的块链存储表示
最新推荐文章于 2024-04-30 23:32:52 发布
