My question is about "delete".
According to the manual, "delete" deletes the portion of memory created by "new".
According to my example, there are values that are not removed, they are still in memory.
The operation of "delete" is correct?
Code: Select all
CLS
'We assign a portion of memory to the variable "p", creating a pointer with 10 indexes.
DIM p AS INTEGER PTR = NEW INTEGER [10]
DIM i AS INTEGER
'we check the initial values of the 10 indices = 0, Ok!
FOR i = 0 TO 9
PRINT i,p[i]
NEXT i
print
'we assign a value to each index, Ok!
FOR i = 0 TO 9
p[i] = i * 5
PRINT i,p[i]
NEXT
'assume that here we remove the pointer variable "p" from memory, OK ???
DELETE p '????
PRINT
'We check again the values of the indices of the variable "p", supposedly the space and the values have been removed from memory.
FOR i = 0 TO 9
PRINT i,p[i]
NEXT i
SLEEP
'Why are some of the indices and values still in memory?
Thanks