Michael Ward
Michael Ward

Reputation: 23

Visual Studio 2012 Error 0xC0000005 Array output

I'll try to keep this as short and simple as I can. I have a decent sized text based RPG in the works as a project for my class. When I try to generate the list of weapons available, I get the error:

Unhandled exception at 0x613240F6 (msvcp110.dll) in game.exe: 0xC0000005: Access violation reading location 0xFFD9EC31

I found a lot about this error but was unable to find a relevant post that helped with my problem. Everything I found had to do with pointers, which I am not using (which I should be, I just don't really understand them and wrote most of this running on 2 hours of sleep and 3 shots of espresso...)

The code is kind of cumbersome and long so I posted the 3 relevant things, the function in which I am getting the error, the function that generates the weapons, and the weapon class.

The code can be found here

Thanks so much for any help you guys can offer!

Upvotes: 1

Views: 3555

Answers (1)

ChaosPandion
ChaosPandion

Reputation: 78272

I examined your code and found an issue with the way you are indexing the shopSelection array. You are indexing a 7th element that does not exist and this explains the access violation error that is being reported. Since the array has a size of 6 then the maximum index is 5.

Upvotes: 2

Related Questions