一般保护故障/堆栈故障 [英] General protection fault/stack fault

查看:102
本文介绍了一般保护故障/堆栈故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我有一个分配结构数组的任务,所以我去尝试但总是出现一些奇怪的错误。现在不仅主程序失败而且另一个程序失败。我想知道的是,这是我的代码中的问题,还是其他事情正在发生?以下是两个程序!!

Well I had an assignment to sort an array of structures so i went about trying but always some strange fault come about. Now not only does the main program fail but also another program. What i want to know is that is it a problem in my code, or something else is happening?? Below are the two programs!!

展开 | 选择 | Wrap | 行号

推荐答案

一般来说,你的程序应该保护自己不要进入大于预分配阵列的大小(不,n);或者从某个人输入一个字符串来获取溢出你预先分配的字符串变量。


据推测,你不会使用超出这些限制的测试用例。这些错误听起来很不祥。我建议你联系你的编译器的技术支持人员,找出这些错误消息的含义。
In general, your programs should protect themselves from somebody entering sizes (no,n) that are bigger than your preallocated arrays; or from somebody entering a string via gets that overflows your preallocated string variables.

Presumably you wouldn''t have used test cases that overflow these limits. The errors you''re getting sound pretty ominous. I suggest you contact your compiler''s technical support folks to find out what these error messages mean.


我正在使用Turbo C ++ 4.5。但是我没有使用变量大小大于预分配数组的情况。我完全混淆了,这是操作系统的错吗?如果你有这个编译器,你可以运行这个程序,看它是否有效,因为我开始认为我的Windows XP而不是代码有问题(不知道为什么我觉得这样可能因为我的机器没有已格式化为3年)
Well I am using Turbo C++ 4.5. However I havent used cases where sizes of variables are greater than their preallocated arrays. I am at a total confusion, is this the operating system''s fault? If u have that compiler can u just run this program and see whether it works or not, as I am begining to think that something is wrong with my Windows XP and not the code(Dont know why I feel that way probably as my machine hasnt been formatted for like 3 yrs)


第一个程序是根据标记对多个结构数组进行排序。标记最低的人首先打印他们的名字和标记,然后打印出更高分的标记,等等!!第二个只是一个简单的程序,在结构中输入数据并在屏幕上重新打印,顺便说一句,如果你觉得代码有问题那么请告诉我!提前致谢!!
The first program is to sort a number of arrays of structures on the basis of the marks. The guy with lowest marks gets their names and marks printed first, then the one with higher marks and so on!! The second is just a simple program to input data in a structure and reprint them on the screen, BTW if u feel there is something wrong with the code then please do let me know!! Thanks in advance!!


这篇关于一般保护故障/堆栈故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆