question

$$ANON_USER$$ avatar image
0 Votes"
$$ANON_USER$$ asked RLWA32-6355 commented

Error code "exited with code -1073741819"

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.

c++
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

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?

0 Votes 0 ·

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

0 Votes 0 ·

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?

0 Votes 0 ·
Show more comments

1 Answer

RLWA32-6355 avatar image
0 Votes"
RLWA32-6355 answered BarrySchwarz-8780 commented

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.


· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

But this code is working in the window from where i copied.

0 Votes 0 ·

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?

0 Votes 0 ·

[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.

0 Votes 0 ·

![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.

0 Votes 0 ·
Show more comments

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.

0 Votes 0 ·

[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.

0 Votes 0 ·
Show more comments

![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.

0 Votes 0 ·