[求助]加急阿!帮我改一下错
#include <stdio.h>#include <malloc.h>
#define N 11
#define error 0
#define EQ(a,b) ((a)==(b))
#define LT(a,b) ((a)<(b))
#define LQ(a,b) ((a)<=(b))
typedef int KeyType;
typedef struct
{
KeyType key;
}ElemType;
typedef struct
{ ElemType *elem;
int length;
}SSTable;
void Creat_Seq(SSTable *ST,ElemType r[],int n)
{
int i;
(*ST).elem=(ElemType*)malloc((n+1)*(sizeof(ElemType)));
if(!(*ST).elem)
exit(error);
for(i=1;i<=n;i++)
(*ST).elem[i]=r[i-1];
(*ST).length=n;
}
int Search_Bin(SSTable ST,KeyType key)
{
int low,high,mid;
low=1;
high=ST.length;
while(low<=high)
{
mid=(low+high)/2;
if EQ(key,ST.elem[mid].key)
return mid;
else if LT(key,ST.elem[mid].key)
high=mid-1;
else
low=mid+1;
}
return 0;
}
int Destroy(SSTable *ST)
{
free((*ST).elem);
(*ST).elem=NULL;
(*ST).length=0;
return 1;
}
main()
{
SSTable st;
int i;
KeyType s;
ElemType r[N]={5,13,19,21,37,56,64,75,80,88,92};
Creat_seq(&st,r,N);
printf("%d\n",(*st).elem[]);这里报错,我想打印出上面的数组
printf("\n");
printf("which you foud: ");
scanf("%d",&s);
i=Search_Bin(st,s);
if(i)
printf("%d this is%d\n",st.elem[i].key,i);
else
printf("no\n");
Destroy(&st);
}