我第一次用c语言阿,写个顺序表的练习,编译起来怎么这么多错误阿,改了半天,也改不过来,谁帮我看看吧,肯定是挺土鳖的错误了,很多很多 #define List_Size 6 #define List_Add 1 #include<stdio.h> #include<alloc.h> typedef int ElemType; #include"save.cpp" #include"save_1.cpp" void main() { int a=1; ElemType Name; Name = 'S'; CreatList( Name ); scanf("%d",&a); DeleteList(Name); scanf("%d",&a); }
struct List_1 { ElemType *point_1; int Length; int ListSize; } // creat list void CreatList (List_1 L) { L.point_1 = (*ElemType)malloc(List_Size * sizeof(ElemType)); if (!L.point_1) { printf ("Creat List was failed"); exit(OVERFLOW); } printf ("Creat List was succeed"); L.Length = 0; L.ListSize = List_Size; } // delete list void DeleteList(List_1 L) { if (L.point_1 !=null) { free(L); L.point_1 = null; L.Length = 0; L.ListSize = 0; printf("List ",L); printf(" has deleted"); } else printf("Delete was failed");
}