编译通过,但是输入数据时候运行出错,求大神帮忙
该怎么改?#include <stdio.h>
#include <malloc.h>
#include <string.h>
typedef struct student{
int cla;
int num;
char name[20];
char sex;
long phone;
}student;
typedef struct {
student *elem;
int length;
}SSTable;
void createlist(SSTable ST){
int i,n;
printf("请输入学生的个数:\n");
scanf("%d",&n);
printf("请输入%d个学生信息(class/name/num/sex/phone):\n",n);
for(i=0;i<n;i++){
scanf("%d %s %d %c %ld",&ST.elem[i].cla,&ST.elem[i].name,
&ST.elem[i].num,&ST.elem[i].sex,&ST.elem[i].phone);
}
}
void searchbin(SSTable ST) {
int low=1,high=ST.length,mid,num,c;
printf("输入查找人的学号和班级号:");
scanf("%d %d",&num,&c);
while(low<=high){
mid=(low+high)/2;
if(ST.elem[mid].num<num) low=mid+1;
else if(ST.elem[mid].num>num) high=mid-1;
else{
if(ST.elem[mid].cla<c)mid++;
else if(ST.elem[mid].cla>c)mid--;
break;
}
printf("class:%d,name:%s,num:%d,sex:%c,phone:%ld\n",ST.elem[mid].cla,
ST.elem[mid].name,ST.elem[mid].num,ST.elem[mid].sex,ST.elem[mid].phone);
}
}
void main(){
SSTable ST;
createlist(ST);
searchbin(ST);
}