求助高手~~ 访问内存冲突(分割故障) 是什么原因造成的!!!!
struct person *del_person (struct person *head)
{
struct person *p1,*p2;
struct person0 *p;
char name[20];
int m=1;
char t;
while(m)
{
fp=fopen("tel_book.txt","rb");
if(fp=NULL){printf("the list is null\n");
exit(0);
}
else
{
p=person;
fread(p,LEN0,1,fp);
if(!feof(fp)){printf("tel_book.txt is empty file!\n");
fclose(fp);
return 0;
}
rewind(fp);
move(fp);
p1=head;
printf("\n Please input the Name for deletion:");
scanf("%s",p1->name);
while(strcmp(name,p1->name)!=0&&p1->next!=NULL)//未找到,并且后面还有结点
{
p2=p1;p1=p1->next;
}
if(strcmp(name,p1->name)==0)
{
if(p1==head)head=p1->next;//p1指向首结点,把第二个结点位置赋予head
else
{p2->next=p1->next;//将下一个结点地址赋给前一结点地址
printf("you have deleted:%s",name);
}
j--;
}
else printf("Can't find the record");
save(head);
}
fclose(fp);
printf(" continue delete?(y / n)\n");
while(getchar()!='\n');
scanf("%c",&t);
if(t!='y')m=0;
return(0);
}
}
/******************************************************************************/
我的main()函数在调用这个含函数是系统说我“访问内存冲突(分割故障) 被提出”
{
struct person *p1,*p2;
struct person0 *p;
char name[20];
int m=1;
char t;
while(m)
{
fp=fopen("tel_book.txt","rb");
if(fp=NULL){printf("the list is null\n");
exit(0);
}
else
{
p=person;
fread(p,LEN0,1,fp);
if(!feof(fp)){printf("tel_book.txt is empty file!\n");
fclose(fp);
return 0;
}
rewind(fp);
move(fp);
p1=head;
printf("\n Please input the Name for deletion:");
scanf("%s",p1->name);
while(strcmp(name,p1->name)!=0&&p1->next!=NULL)//未找到,并且后面还有结点
{
p2=p1;p1=p1->next;
}
if(strcmp(name,p1->name)==0)
{
if(p1==head)head=p1->next;//p1指向首结点,把第二个结点位置赋予head
else
{p2->next=p1->next;//将下一个结点地址赋给前一结点地址
printf("you have deleted:%s",name);
}
j--;
}
else printf("Can't find the record");
save(head);
}
fclose(fp);
printf(" continue delete?(y / n)\n");
while(getchar()!='\n');
scanf("%c",&t);
if(t!='y')m=0;
return(0);
}
}
/******************************************************************************/
我的main()函数在调用这个含函数是系统说我“访问内存冲突(分割故障) 被提出”
...全文
相关推荐
常见网络故障
#### 软件配置错误软件配置错误是网络故障的常见原因之一,特别是涉及到网络共享和远程访问的服务。**常见故障:**1.
打印机故障清除:提升办公效率的技术指南
ClearPrnLst.exe是一个高效的工具,专为解决Windows环境下打印机队列中的问题而设计。无论是因错误操作、程序崩溃还是恶意软件干预导致的打印队列堵塞,ClearPrnLst.exe都能通过简单的操作快速清除堵塞,让打印机恢复正常工作。
jupyter notebook 使用过程中python莫名崩溃的原因及解决方式
- **分批处理数据**:对于大规模数据处理任务,可以考虑将数据分割成多个小批次进行处理。 - **清理无用变量**:及时释放不再使用的变量所占用的内存。
路由器常见故障排除的解决方法
TCP/IP连接故障**- **原因分析**:可能是由于IP地址冲突、子网掩码错误、网关设置不当等问题引起。
一种基于智能家居的规则冲突避免机制.pdf
在智能家居系统中,规则冲突避免机制显得尤为重要。冲突的规则可能导致无法预期的行为,甚至系统故障。为了规避这些问题,必须在规则执行前进行详细的冲突检测,确保规则之间的一致性和协调性。


