title: Why am I getting a seg fault when I try to push_back an item in C++?
body: <p>I'm working on a hash table lab for my Data Structures class. I keep getting a set fault which I think is happening when I use the push_back() function within the insert function. However, I am not sure what is causing this error.</p>
  
  <pre><code>    using namespace std;
  
      HashTable::HashTable(int buckets) {
          this-&gt;buckets = buckets;
          vector&lt;Entry&gt;* table = new vector&lt;Entry&gt;[buckets];
      }
  
  
      Entry HashTable::insert(GameBoard board, int number) {
          int index = compress(board.hashCode());
          Entry entry = Entry(board, number);
          table[index].push_back(entry);
          return entry;
      }
  
  
      int HashTable::compress(int hashCode) {
          return (hashCode % buckets);
      }
  
  
      Entry::Entry(GameBoard board, int value) { 
          this-&gt;board = board; 
          this-&gt;value = value; 
      }
  
  
      int GameBoard::hashCode() {
  
          int hashVal = 0;
  
          for (int r = 0; r &lt; DIMENSION; r++) {
              for (int c = 0; c &lt; DIMENSION; c++) {
                  hashVal = ((127 * hashVal) + board[r][c]) % 16908799;
              }
          }
  
          return hashVal;
      }
  </code></pre>