请帮我看看错误在哪?
#include<stdio.h>
#include<malloc.h>
#include<string.h>
typedef struct room //结构体定义
{
char a[100];//存储姓名
int ID; //存储学号
int num; //存储房号
int length;
}room;
void creat(room *p) //对宿舍人员的信息输入
{
int i,n;
printf("请输入人数:\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("请输入第%d个人的信息,请按姓名、学号、房号输入:\n",i);
scanf("%s",p[i].a);
scanf("%d",&p[i].ID);
scanf("%d",&p[i].num);
}
p[0].length=n;
}
void xm_order(room *p)//对姓名排序
{
int i,j;
room temp;
for(i=1;i<p[0].length;i++)
{
for(j=i+1;j<=p[0].length;j++)
{
if(strcmp(p[i].a,p[j].a)>0)
{
temp=p[i];
p[i]=p[j];
p[j]=temp;
}
}
}
}
void xm_search(room *p)//按姓名进行查找
{
char xm[100];
int low,high,mid;
printf("请输入查询人的姓名:\n");
scanf("%s",xm);
for(low=1,high=p[0].length;high>=low;)
{
mid=(low+high)/2;
if(strcmp(p[mid].a,xm)>0)
high=mid-1;
else if(strcmp(p[mid].a,xm)<0)
low=mid+1;
else if(strcmp(p[mid].a,xm)==0)
{
printf("%s %d %d\n",p[mid].a,p[mid].ID,p[mid].num);break;
}
}
if(high<low)
printf("无此人员并检查输入\n");
}
void xh_order(room *p)//对学号排序
{
int i,j;
room temp;
for(i=1;i<p[0].length;i++)
{
for(j=i+1;j<=p[0].length;j++)
{
if(p[i].ID>p[j].ID)
{
temp=p[i];
p[i]=p[j];
p[j]=temp;
}
}
}
}
void xh_search(room *p)//按学号进行查找
{
int xh;
int low,high,mid;
printf("请输入查询人的学号:\n");
scanf("%d",&xh);
for(low=1,high=p[0].length;high>=low;)
{
mid=(low+high)/2;
if(p[mid].ID>xh)
high=mid-1;
else if(p[mid].ID<xh)
low=mid+1;
else if(p[mid].ID==xh)
{
printf("%s %d %d\n",p[mid].a,p[mid].ID,p[mid].num);break;
}
}
int main()
{
room *s;
s=(room*)malloc(100*sizeof(room));
creat(s);
xm_order(s);
xm_search(s);
xh_order(s);
xh_search(s);
return 0;
}