Unhandled exception at 0x009F1E7B in code.exe: 0xC0000005: Access violation reading location 0x990EC60C

0

So, I'm a little newbie about c++ but I know some basics. So I have a tridimensional matrix p[11][4][4] whit full with hex values. So if I do somenthing like this:

for (int i = 1; i <= 10; ++i)
        {
           somefunction1(something, p[i]);
            somefunction2(something, p[i]);
        }

and the i is incremented automaticaly to 10, evreything works fine. but, if I do something like this:

 for (int i = 10; i>=10; --i)
            {
               somefunction1(something, p[i]);
                somefunction2(something, p[i];
            }

I get the error above. If I do the same thing but with I from 9, evreything works grate. An other thing that I have noticed, if I print the matrix my ten value is an 'a' 10 in base 16.

i=9
p[9][0][0]=ac p[9][0][1]=19 p[9][0][2]=28 p[9][0][3]=57
p[9][1][0]=77 p[9][1][1]=fa p[9][1][2]=d1 p[9][1][3]=5c
p[9][2][0]=66 p[9][2][1]=dc p[9][2][2]=29 p[9][2][3]=0
p[9][3][0]=f3 p[9][3][1]=21 p[9][3][2]=41 p[9][3][3]=6e


i=a
p[a][0][0]=d0 p[a][0][1]=c9 p[a][0][2]=e1 p[a][0][3]=b6
p[a][1][0]=14 p[a][1][1]=ee p[a][1][2]=3f p[a][1][3]=63
p[a][2][0]=f9 p[a][2][1]=25 p[a][2][2]=c p[a][2][3]=c
p[a][3][0]=a8 p[a][3][1]=89 p[a][3][2]=c8 p[a][3][3]=a6

As you have noticed every single pointer is a number except when I is incremented to 10.

So I'm guessing the problem is tht when I'm trying to use p[10] I get this erroe because p[10] was not initialized. Because I have a 'p[a]' not a 'p[10]'. I also tried whit '0xa', same error. How cand I solve this issue?

hex
asked on Stack Overflow May 26, 2021 by Mark John

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0