I have this code:

```
#include <iostream>
using namespace std;
char* pass(char* p){
    char* a = new char[10];
    a[0] = 'S';
    a[1] = 'e';
    a[2] = 'r';
    a[3] = 'g';
    a[3] = 'e';
    a[3] = 'y';
    a[4] = '\0';
    p = a;
    //delete [] a;
    return p;
}
int main(int argc,char* argv[]){
    char* p1 = new char[1000];
    p1[0] = 'G';
    p1[1] = 'e';
    p1[2] = 'r';
    p1[3] = 'y';
    p1[4] = '\0';
    char* p2 = p1;
    cout << p2 << endl;
    cout << pass(p2) << endl;
    delete [] p1;
}

```

and the output is :

```
Gery
Sery

```

but if I uncomment the line `delete [] a`
I got this output :

```
Gery
ê§É

```

Why?