《数据结构编程实例》.docVIP

  • 9
  • 0
  • 约1.08万字
  • 约 17页
  • 2019-12-02 发布于天津
  • 举报
数据结构编程实例 顺序表的基本操作 #define LEN 100 typedef struct sqlist{ int a[LEN]; int length; }; void init(struct sqlist *sq) /*初始化*/ {int i; for (i=0;iLEN;i++) sq-a[i]=0; sq-length=0; } void creat(struct sqlist *sq) /*建顺序表*/ {int i; printf(please input length); scanf(%d,sq-length); printf(please input %d nums\n,sq-length); for (i=1; i=sq-length;i++) scanf(%d,sq-a[i]); } void print(struct sqlist *sq) /*输出顺序表*/ { int i; for (i=1; i=sq-length;i++) printf( %d,sq-a[i]); printf(\n); } void insert(struct sqlist *sq,int pos, int x) /*顺序表插入元素*/ {int i; for (i=sq-length;i=pos;

文档评论(0)

1亿VIP精品文档

相关文档