The program returns "This program has encountered a problem and needs to close. Has to be some sort of memory problem. I haven't tried this in visual studio. maybe that will help the debugging, but i know the dissassembly will be cryptic. If someone could tell me if the first line of code is possible, or what the specifications are on using members of arrays as indices it would be a great help.
It's perfectly legal code. There's nothing special about an array member - as long as it's an integer, it's legal to use it as an array index.
If you're sure that the crash is happening because of this, then my guess would be that whatever value is stored in normalIndex[i] is bigger than the number of elements you've allocated for Normal. Use a debugger to see what the value of normalIndex[i] is at the point where the crash occurs.
It's perfectly legal code. There's nothing special about an array member - as long as it's an integer, it's legal to use it as an array index.
If you're sure that the crash is happening because of this, then my guess would be that whatever value is stored in normalIndex[i] is bigger than the number of elements you've allocated for Normal. Use a debugger to see what the value of normalIndex[i] is at the point where the crash occurs.
If you had crash with array, I claim it is "Access Violation".
Operating System will assign certain size of space on RAM to your program. If you do this:
1 2
int a[10];
a[99999] = 1;
The chance is high that your program try to assign value to space which not belong to the space the program is assigned.
If your program got enough space, I don't know. That is not error at all, which is bad because you don't know what's gonna happen.
That is so called "Out of range". STL throws exception to let user know if it went out of range so the program crash itself, but array has no check for that.
Make sure your program does not give any weird index to subscript operator[].