title: c++ function that fills array
body: <p>What I'm trying to do:</p>
  
  <p>User inputs two numbers.
  Array is declared using those numbers as dimensions.
  Function outside <code>main()</code> is filling the array.
  Array is accessed in <code>main()</code> for further thingies.</p>
  
  <p>What I have problem with:</p>
  
  <p>Function + array combination doesn't seem to work as I think.</p>
  
  <p>What I did:</p>
  
  <pre><code>void tablica1(int h, int w)
  {
      int m,n;
  
      for(m=0; m&lt;h; m++)
          for(n=0; n&lt;w; n++) 
          {
              arr[h][w]=1;
          }
  }
  </code></pre>
  
  <p>What happens:</p>
  
  <p>array arr is inaccessible in <code>tablica1()</code> because it has not been declared in that function.</p>
  
  <p>Of course, when I declare the array in <code>tablica1()</code> it becomes inaccessible in <code>main()</code>.</p>
  
  <p>Possible solutions:</p>
  
  <ul>
  <li>Passing arr to <code>tablica1()</code> as a reference - no idea how to do that</li>
  <li>Declaring arr in <code>tablica1()</code> and somehow passing it to <code>main()</code> - no idea how to do that</li>
  </ul>
  
  <p>Other possible solutions?</p>