first of all, how come you can do this in C++ and not in C

int a[n];

secondly, why is the array "a" being printed after i freed it in the following piece of code:

int *a = new int[10];
for (int i = 0; i < 10; ++i)
a[i] = i + 1;

delete [] a;

for (int i = 0; i < 10; ++i)
cout << a[i] << " ";

kind regards