modifying contents of local variable of a function in a subfunction through pointer
<p>I have the following sample code. Just wanted to know if is valid to take address of a local variable in a global pointer and then modify it's contents in a sub function. Following program correctly modifies value of variable <strong>a</strong> . Can such practice cause any issues ?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

vector&lt;int*&gt; va;

void func()
{
   int b ;
   b = 10;
   int * c = va[0];
   cout &lt;&lt; "VALUE OF C=" &lt;&lt; *c &lt;&lt; endl;
   *c = 20;
   cout &lt;&lt; "VALUE OF C=" &lt;&lt; *c &lt;&lt; endl;


}
int main()
{
     int a; 
     a = 1;
     va.push_back(&amp;a);

     func();

     cout &lt;&lt; "VALUE IS= " &lt;&lt; a &lt;&lt; endl;

     return 0;
}
</code></pre>
