I've noticed that when using Power Render if I have an array in my program, for example
int GunStage[99];
this array will hold an integer in spaces zero through ninety-eight. Example:
for (int AA = 0; AA <= 99; AA++)
{
CurrentStage = GunStage[AA];
...
...
}
would make the program do the following things:
1. when the program is running, whatever was SUPPOSED to be stored in [99] becomes garbage. I did a test using a simple loop that would first fill up a char TestCharA[11]; array with 'A' in each space. Then it would print the contents of the array:
AAAAAAAAAAA§
AAAAAAAAAAA%
AAAAAAAAAAAx
AAAAAAAAAAAW
AAAAAAAAAAA5
etc.
2. when the program finally quits (for example, when I hit esc). an Access Violation occurs after the last line of code(PR_Shutdown). So when it is trying to unload the program it tries to access memory that was not allocated.
This:
for (int AA = 0; AA <= 98; AA++)
{
CurrentStage = GunStage[AA];
...
...
}
would work just perfect. Now if i remember correctly from my programming courses an array with [99] should hold 100 things (0 - 99).
So far to correct this I make all my arrays in my program one larger than they need to be. This fixes the problem, but it seems like it shouldn't be necissary to do that.
Does this seem strange to anyone other than me?!
-Rich
Edited by - PsycoBlade on June 20, 2001 1:09:39 PM