In c/c++:
The delete operator is used to delete a dynamic array, but after deleting an array using delete operator, then printing it, some values still the same. why ?- I expect the values to be garbage.
#include <iostream>
using namespace std;
int main()
{
    int n=5;
    int*A=new int[n];
    for (int i=0;i<n;i++)
       A[i]=i+1;
    delete [] A; //deleting 'A' array
    for (int i=0;i<n;i++)
       printf("%d ",A[i]);
}
The output will be:
0 0 3 4 5
If we remove delete [] A; the output will be :
1 2 3 4 5
Why some values of the array still be the same assuming that he elements of the array should have garbage values?
 
    