title: how to save the node into a array
body: <p>I want to use an array to store nodes, and then when I need to use part of the data, I can use the Get function to extract the data (like printing), but when I run it, it shows</p>
  <p>Segmentation fault (core dumped)</p>
  <p>Where is the problem?</p>
  <pre><code>///node.h
  class Node{
   public:
    Node();
    Node(string type, string address);
    string GetType();
    string GetAdd();
  
   private:
    string m_type;
    string m_address;
  };
  
  #endif
  </code></pre>
  <pre><code>///node.cpp
  Node::Node(){
    m_type = &quot;&quot;;
    m_address = &quot;&quot;;
  }
  
  
  Node::Node(string type, string address){
    m_type = type;
    m_address = address;
  }
  
  
  string Node::GetType(){
    return m_type;
  }
  
  
  string Node::GetAdd(){
    return m_address;
  }
  </code></pre>
  <pre><code>/////main
  int main(){
    Node* arr;
    int num_arr = 0;
    string type = &quot;n&quot;;
    string address = &quot;003&quot;;
    Node* newNode = new Node(type, address);
    arr[num_arr] = *newNode;
    cout &lt;&lt; arr[0].GetType() &lt;&lt; endl;
  }
  
  </code></pre>