title: How can i increase value of x in function?
body: <p><strong>C++ Program: -</strong> I know that in the function definition, x is not passed so it would get error message but i want to increase in function, so what can i do?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  fun(int&amp; p)
  {
      cout &lt;&lt; p;
      x++;
  }
  int main()
  {
      int x = 15;
      int c = 1;
      fun(c);
      cout &lt;&lt; x;
      return 0;
  }
  </code></pre>