title: How do I access boolean array from another function? c++
body: <p>I have a problem. I need to create a code where I can access bool array information from another function, edit the array and then send it back. I need to use a variable as the size of the array.</p>
  <p>Global variable is not an option.</p>
  <p>I've tried to pass it by a reference and also using structs.</p>
  <p>code for example:</p>
  <pre><code>void x(bool (&amp;reserved[sizeOfArray)) {
      if (reserved[1] == true) {
            cout &lt;&lt; &quot;it's true&quot;;
  
  }    
  
  main() {
  
  int sizeOfArray = 6;
  bool reserved[sizeOfArray];
  
  x(reserved[sizeOfArray];
  </code></pre>
  <p>edit: the size of the array is determined when the program is already running</p>