Creating a global dynamically-allocted array
<p>I am new to C/C++ and I had a question about dynamically allocating arrays.  Can you not make a global dynamically allocated array?  What if I wanted arr to be used by multiple functions? Would I have to pass arr to every function? Basically I guess I am still confused on the concept of dynamically allocated arrays and how I could create an array that can be used by a few functions. </p>

<p>The following produces : error: ‘arr’ does not name a type, but I am not sure exactly why.</p>

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

using namespace std;

int * arr = NULL;
arr = new int [10];

int main() {
   arr[0] = 1;
   return 0;
}
</code></pre>
