I copied my C code from one window and paste it to another window of VS2019, then i debugged the program and i got the message "Test.exe exited with code -1073741819". I am unable to run the program so please help me out.
I copied my C code from one window and paste it to another window of VS2019, then i debugged the program and i got the message "Test.exe exited with code -1073741819". I am unable to run the program so please help me out.
anonymous user
According to the code you provided, I couldn't reproduce the issue.
Actually i created two files in VS2019 to write two different code, but when i copied my code from one window and paste it to another then i got this error but when i type the same code then i do not get error.
Could you please provide some steps that help us reproduce the issue? Whta do you mean "i copied my code from one window and paste it to another"?
And have you used the debugger to check the failed program step by step?
Please see this screenshot of the two files Test1.c and Test.c, actually i copied my code from Test.c and then pasted it to Test1.c. In Test.c, i am not getting any error but when i debugged it in Test1.c i am getting this error " exited with code -1073741819". [1]: /answers/storage/attachments/93608-stack-using-linked-list-image.png
when i debugged it in Test1.c i am getting this error " exited with code -1073741819".
Do you know how to step through code line by line in the debugger?
The exit code -1073741819 in hex is 0xC0000005. If you look up this code in Microsoft's documentation (NTSTATUS Values) you will see that it indicates that your program was terminated due to an access violation. This error can occur for a variety of reasons, including de-referencing a NULL pointer or referencing an invalid address.
You should step through your code in the debugger line by line to determine where the access violation happens. That should enable you to analyze the situation and identify the cause.
Your comment about copying code (that we haven't seen) from one window to another does not provide any useful information.
Post the code that comprises the Test.exe program that abnormally terminates.
Also, did you step through the failing program in the debugger as I suggested?
[93085-stack-using-linked-list-delete.txt][1] [1]: /answers/storage/attachments/93085-stack-using-linked-list-delete.txt please download the text file in which code is written.
![93117-stack-using-linked-list-image.png][1] [1]: /answers/storage/attachments/93117-stack-using-linked-list-image.png Here is the screenshot of the code in two different window.
If the code you copied from was compiled with a different compiler or different options, it is possible that some uninitialized memory just happened to contain a "good" value whereas the newly compiled code does not. Using the value contained in uninitialized memory causes undefined behavior. One of the worst forms of undefined behavior is to do what you expect. However there is no reason to expect that undefined behavior will always do the same thing.
A similar difference between your two executables could be the way local arrays are mapped. In one case, running off the end of an array may go undetected and also cause no obvious problems while in the other it may cause you to access memory you don't own. In either case, it is still undefined behavior and the previous comments apply.
That is why we need to see the code that causes the problem. But you can analyze the situation yourself by stepping through the code under the debugger as previously suggested.
[93122-stack-using-linked-list-delete.txt][1] [1]: /answers/storage/attachments/93122-stack-using-linked-list-delete.txt Please download the text file in which the code is written.
![93123-stack-using-linked-list-image.png][1] [1]: /answers/storage/attachments/93123-stack-using-linked-list-image.png Here is the screenshot of the two windows.
8 people are following this question.