Returning by reference
<p>Sorry if the question is very basic. </p>

<p>PROGRAM 1:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int   max(int &amp;a)
{
   a +=100;
   return a;
}

int main ( int argc, char ** argv)
{

  int x=20;
  int y;
  y = max(x);
  cout &lt;&lt;"x , y value is  "&lt;&lt;x&lt;&lt;"and"&lt;&lt;y&lt;&lt;endl;
 }
</code></pre>

<p><strong>OUTPUT:</strong></p>

<p>x, y  value is 120and120</p>

<p>PROGRAM 2:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int &amp; max(int &amp;a)
{
   a +=100;
   return a;
}

int main ( int argc, char ** argv)
{

  int x=20;
  int y;
  y = max(x);
  cout &lt;&lt;"x , y value is  "&lt;&lt;x&lt;&lt;"and"&lt;&lt;y&lt;&lt;endl;
 }
</code></pre>

<p><strong>OUTPUT:</strong></p>

<p>x, y  value is 120and120</p>

<p>The only difference between PROGRAM1 and PROGRAM2 is that the second program returns by reference. What is exactly the difference?</p>
