In C++, following the code below:

```
    char *p = new char();
    *p = 'a';
    *(p+1)= 'b';
    *(p+2) ='\0';
    cout<<p<<endl;

```

we can get the output result: ab

When I want to write the code like this:

```
    int *p = new int();
    *p = 1;
    *(p+1)= 2;
    cout<<p<<endl;

```

It gives the result, but not 12 or something start with 12

Question is why the result goes wrong when changing it from char to integer? How to realize the goal that output a list of value by using a pointer dynamic array?