顺序表的基本操作.docVIP

  • 12
  • 0
  • 约5.97千字
  • 约 7页
  • 2017-02-13 发布于重庆
  • 举报
顺序表的基本操作

#include stdio.h #include stdlib.h #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define OVERFLOW -2 typedef int status; typedef int elemtype; #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 typedef struct{ elemtype *elem; int length; int listsize; }SqList; status InitList_Sq(SqList *L) //构造一个空的顺序表 { L-elem=(elemtype*)malloc(LIST_INIT_SIZE*sizeof(elemtype)); if(!L-elem) exit(OVERFLOW); L-length=0; L-listsize=LIST_INIT_SIZE; return OK; } void shengcheng_Sq(SqList *L) //建立一个顺序表,含有n个数据元素。 { int m,n; printf(请输入元素的个数:); scanf(%d,n); printf

文档评论(0)

1亿VIP精品文档

相关文档