#include <stdio.h>
#include <stdlib.h>
#define LISTSIZE 100
typedef int DataType;
typedef struct {
DataType list[LISTSIZE];
int length;
}SeqList;
#include "SeqList.h"
/*合并顺序表 A 和 B 到 C 的函数声明*/
void MergeList(SeqList A, SeqList B, SeqList *C);
void main() {
int i, flag;
DataType a[] = { 6, 11, 11, 23 };
DataType b[] = { 2, 10, 12, 12, 21 };
DataType e;
SeqList A, B, C;
InitList(&A);
InitList(&B);
InitList(&C);
/* 数组 a 中的元素插入到顺序表 A 中 */
for (i = 1; i <= (sizeof(a) / sizeof(a[0])); i++) {
flag = InsertList(&A, i, a[i - 1]);
if (flag == 0) {
printf("插入位置非法!");
return;
}
}
/* 数组 b 中的元素插入到顺序表 B 中 */
for (i = 1; i <= (sizeof(b) / sizeof(b[0])); i++) {
flag = InsertList(&B, i, b[i - 1]);
if (flag == 0) {
printf("插入位置非法!");
return;
}
}
printf("顺序表A中的元素:\n");
for (i