The first gives me an error when I run the program. The latter doesn't even compile.
I need to delete it because I run the function(); several thousand times. And values from the previous run are bleeding over. I need the array completely cleared before it gets called again. For some immensely stupid reason it is not automatically doing so. It just leaves the old values in there which creates a gigantic mess. I'm using the getposition(array, variable); and while debugging I found that the errors were caused by getposition finding positions from variables that USED TO exist in a previous run of the function. Which should NEVER HAPPEN. But it does for some idiotic reason.
I tried setting all values to 0... that doesn't work. It still finds the old values through getposition. Tried doing it without a loop even. Sat there and did array[0] =0; array[1]=0; etc etc all the way up the end. STILL DOESNT WORK. It's just stuck on stupid, it has to find the old values.
It sounds like you're not initialising something correctly. delete on a built in type does not change the memory content of that thing, although special debug mode memory managers might, but that's switched off for a release build.
It's just stuck on stupid, it has to find the old values.
I guarantee you the code is doing exactly what you're telling it to do.
From you description, it sounds like you are either using an old pointer to an array that was reallocated (pointer points to where it used to be), or you're passing the array by value and clearing the copy.
Without seeing your code, there is no way to tell.