首先,函数的定义应该在main函数的外部,而不是在内部。
其次,在函数的参数列表中,变量的类型应该在变量名之前,而不是在后面。
另外,函数体内的打印语句应该使用printf函数而不是print函数。
最后,当返回值为整数时,应该使用关键字"return"而不是"return null"。
参考代码:
#include <stdio.h>
typedef int datatype;
#define maxsize 1024
typedef struct
{
datatype data[maxsize];
int last;
} sequenlist;
int INSERT(sequenlist *L, datatype x, int i)
{
int j;
if (L->last >= maxsize - 1)
{
printf("overflow");
return 0;
}
else if (i < 1 || i > L->last + 1)
{
printf("error");
return 0;
}
else
{
for (j = L->last; j >= i - 1; j--)
{
L->data[j + 1] = L->data[j];
}
L->data[i - 1] = x;
L->last = L->last + 1;
}
return 1;
}
int DELETE(sequenlist *L, int i)
{
int j;
if (i < 1 || i > L->last + 1)
{
printf("error");
return 0;
}
else
{
for (j = i; j <= L->last; j++)
{
L->data[j - 1] = L->data[j];
}
L->last--;
}
return 1;
}
int main()
{
sequenlist L;
// 其他操作...
return 0;
}
|