title: C++" reference to local variable returned "
body: <p>I'm getting an error with this function. Saying " warning: reference to local variable 'final' returned" Any ideas what is wrong with it? And how to fix it?</p>
  
  <pre><code>vector&lt;int&gt; &amp; find1(string &amp;search_word)
  {
      vector&lt;int&gt; final;
  final.push_back(2);
  final.push_back(5);
  
  
  return (final); //This is giving me the error when I try to return the vector.
  
  }
  
  int main ()
  
  {
  string search;
  
  cin &gt;&gt; search;
  
  vector &lt;int&gt; &amp;p = find1(search);
  
  
  }
  </code></pre>