帮忙看个问题,顺序表的初始化。

来源:百度知道 编辑:UC知道 时间:2024/06/20 09:18:13
两处错误,在后面标出来了
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define list_init_size 100
#define listincreasement 10
#define elemtype char
typedef struct list{
elemetype *elem;//Declaration missing ;
int listsize;
int length;
}sqlist;
status *initlist_sq(sqlist *L)//Declaration syntax error
{
L->elem=(elemetype*)malloc(list_init_size*sizeof(elemtype));
if(!L->elem)printf("\nfailde\n");return 0;
L->length=0;
L.listsize=list_init_size;
printf("\nOk\n");
return 1;
}

改过的代码如下,大部分是拼写错误或声明错误啥的,有问题再hi我

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define list_init_size 100
#define listincreasement 10
#define elemtype char
typedef struct list{
elemtype *elem;//Declaration missing ;
int listsize;
int length;
}sqlist;
int initlist_sq(sqlist *L)//Declaration syntax error
{
L->elem=(elemtype*)malloc(list_init_size*sizeof(elemtype));
if(!L->elem)printf("\nfailde\n");return 0;
L->length=0;
L->listsize=list_init_size;
printf("\nOk\n");
return 1;
}

来自:求助得到的回答

status *initlist_sq(sqlist *L)//Declaration syntax error
中用status为什么?