简体   繁体   中英

Any reasons for code not running on DEV C++ but running perfectly on Visual Studio?

So my code compiles on Dev C++ but when it runs, it gives a blank output screen for a few seconds then the program terminates. The code on Dev shows no errors or warnings. It works perfectly on VS. I have tried re-installing Dev but that doesn't work. I know Dev is outdated but i'm forced to check my code on it since its a project and will be checked and graded on Dev. I did not feel like posting the whole code since it is around 400 lines but since it might or might not help in understanding the problem, i have attached it. I don't know which part might cause this issue so i've attached the whole thing. I hope you don't mind. This is my first post here so if I've made any mistakes in asking a question please let me know. Thanks.

Thank you so much to @LouisGo and @molbdnilo for the help. I've found the reason for the segmentation error in Dev C++ through debugging. This part: *hashArray = NULL;//SET ARRAY INDEXES TO NULL was the problem. Dev C++ doesn't allow initializations in this way while VS does. So I had to initialize it this way:

for(int i=0; i<20; i++)
        {
            hashArray[i]=NULL;
        }

It works fine now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM