我用的gcc
代码运行不报错但就是执行不了。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#define list 10
#define max 10
typedef int Elemtype;
typedef struct sqlist
{
Elemtype *elem;
int lenght;
int listsize;
}*List;
void intlist (List L)
{
L->elem=(Elemtype *)malloc(list*sizeof(Elemtype));
L->lenght=0;
L->listsize-max;
}
void creat(List L,int a[])
{
intlist(L);
int i;
for(i=0;i<max;i++)
{
L->elem[i]=a[i];
L->lenght++;
}
}
int print(List L)
{
int i;
L->lenght=0;
for(i=0;i<max;i++)
{printf("%d",L->elem[i]);
L->lenght--;}
return 0;
}
int main(List L)
{
int a[10]={1,2,3,4,5,6,7,8,9,0};
creat(L,a);
print(L);
return 0;
}