title: Why "&" is needed during calling this list?
body: <p>I was studying LISTs and playing with function, this program gives 10 number and each time if the entered number is the bigger than the maximum value in our list, that number will be added to our list and  finally after 10 tries all members will show up. The program works fine, but what I don't understand is why  do I need use "&amp;" in the line 6: " void insertMax(list &amp;lst, int n) {"??</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;list&gt;
  
  using namespace std;
  
  void insertMax(list&lt;int&gt; &amp;lst, int n) {
      lst.sort();
      int max = lst.back();
      if (n &gt; max) {
          lst.push_back(n);
      }
  }
  
  void disply(list&lt;int&gt; lst) {
      list&lt;int&gt;::iterator iter = lst.begin();
      while (iter!=lst.end()){
          cout &lt;&lt; *iter &lt;&lt; endl;
          iter++;
      }
  }
  
  int main()
  {
      list&lt;int&gt; numbers;
      numbers.push_back(0);
      int input=0;
      for (int j = 1; j &lt; 11; j++){
          cout &lt;&lt; "Enter a number: " &lt;&lt; endl;
          cin &gt;&gt; input;
          insertMax(numbers, input);
      }
      cout &lt;&lt; "Now that's all: " &lt;&lt; endl;
      disply(numbers);
      return 0;
  }
  </code></pre>
  
  <p>Thanks in advance.</p>