#include<stdio.h>
typedef struct Node{
int A[100];
int Length;
}StaticTable;
int BinerySearch(StaticTable *Tb1,int K){
/**/
}
return NotFound;
}
int SequentialSearch(StaticTable *Tb1,int K){
/**/
}
int main(){
StaticTable *Tb1;
for(int i=1;i<=10;i++){
Tb1->A[i]=5;//执行到这里就会出错,可是我看不出哪里错了,求大佬指点
}
Tb1->Length=10;
printf("%d\t",SequentialSearch(Tb1,36));
printf("%d",BinerySearch(Tb1,36));
return 0;
}
C语言结构体里的数组出错
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- threenewbee 2020-03-03 19:47关注
你光定义了指针,没有分配空间
StaticTable *Tb1 = (StaticTable *)malloc(sizeof(StaticTable));
问题解决的话,请点采纳
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报