#include#include #define MaxSize 60#define ElemType inttypedef struct { ElemType data[MaxSize]; int length;}SqList;void CreateList_Sq(SqList *&L,ElemType a[],int n){ //建立线性表 int i; L = (SqList *)malloc(sizeof(SqList)); /*分配存放线性空间*/ for(i = 0;i < n;i++){ L -> data[i] = a[i]; } L -> length = n; /*令线性表L的长度为n*/}int main(){ SqList * L; int i; ElemType a[] = { 1,2,3,4,5}; CreateList_Sq(L,a,sizeof(a)/sizeof(int)); for(i = 0;i < 5;i++){ printf("%d\n",L->data[i]); } return 0;}