The difference between char*s=new char[] and char s[20]?
<pre><code>#include&lt;iostream&gt;
#include&lt;process.h&gt;
using namespace std;
template&lt;class T&gt;
class List{
    class Node{
    public:
        T num;
        Node*next;
    }*head,*tail;
public:
    List(){
        head = tail = NULL;
    }
    void insert(T *n){
        Node*tmp=new Node;
        tmp-&gt;next = head;
        tmp-&gt;num = *n;
        head = tmp;
        if (tail == NULL){
            tail = tmp;
        }
    }
    void append(T*n){
        Node*tmp=new Node;
        tmp-&gt;next=NULL;
        tmp-&gt;num = *n;
        if (tail == NULL){
            head = tail = tmp;
        }
        else {
            tail-&gt;next = tmp;
            tail = tmp;
        }
    }
    T Get(){
        if (head == NULL){
            exit(0);
        }
        else{
            T t = head-&gt;num;
            Node*p = head;
            if (head-&gt;next == NULL){
                head = tail = NULL;
            }
            else{
                head = head-&gt;next;
            }
            delete (p);
            return t;
        }
    }
};
class person{
public:
    char*name=new char[];//problem lies here!
    //char name[20];
    int age;
    float hight;
    person(){}
};
int main(){
    person a;
    List&lt;int&gt;link1;
    List&lt;person&gt;link2;
    for (int i = 0; i &lt; 5; i++){
        cin &gt;&gt; a.name &gt;&gt; a.age &gt;&gt; a.hight;
        link2.insert(&amp;a);
        link1.append(&amp;i);
    }
    for (int i = 0; i &lt; 5; i++){
        a = link2.Get();
        link2.append(&amp;a);
        cout &lt;&lt; a.name &lt;&lt; " " &lt;&lt; link1.Get() &lt;&lt; endl;
    }
}
</code></pre>

<p>As the explanation goes in the code, when using <code>char*name=new char[]</code> to replace <code>char name[20]</code>, the program went wrong. It wouldn't output all the names as expected, but only print the last input name 5 times. So what's the difference between these two expressions?
Thanks a lot.</p>