数据结构顺序表C语言实现
include include define MAXSIZE 100
typedef int Position; typedef struct LNode *List; struct LNode{
int Data[MAXSIZE]; Position last; };
List initList(){
List L; L = (List)malloc(sizeof(struct LNode)); L->last = -1; printf('初始化成功n'); return L; }
List createList(List L){
int n,i=1; printf('请输入创建表的元素个数:'); scanf('%d',&n); for(i=1;i
printf('n请输入第%d个元素:',i); scanf('%d',&L->Data[i]); } printf('n'); for(i=1;i
printf('创建的表为:'); printf('%dn',L->Data[i]); } }
void main(){
List L = initList(L); createList(L); }
赞0
踩0