标签:flow inf incr exit size typedef com amp str
1、顺序表初始化实战:
#include<stdio.h>
#include<stdlib.h>
#define OK 1
#define OVERFLOW 0
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct
{
  char *elem;
  int length;  //当前长度
  int listsize;  //线性表的长度
}Sqlist;
/*线性表的初始化*/
int InitList(Sqlist *L)
{
  L->elem=(char*)malloc(LIST_INIT_SIZE*sizeof(char*));
  if(!L->elem)exit(OVERFLOW);
  L->length=0;
  L->listsize=LIST_INIT_SIZE;
 return OK;
}
int main()
{
  int i;
  Sqlist L;
  i=InitList(&L);
  printf("i=%d\n",i);
  return 0;
}
 
标签:flow inf incr exit size typedef com amp str
原文地址:https://www.cnblogs.com/gufengchen/p/12268156.html