title: How can I use variables in C++ without passing into a function
body: <p>Is there a way in C where you can use variables that you don't pass in variables?</p>
  
  <p>I'm working on some code that someone else started on and I'm just modifying it.</p>
  
  <p>Here is some code that I have.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  using namespace std;
  void rotate90() {
      for (int w=0;w&lt;n;w++) {
          for (int h=0;h&lt;n;h++) {
              chart2[h][w]=chart[n1-w][n1-h];
          } 
      }
      for (int h=0;h&lt;n;h++) {
          for (int w=0;w&lt;n;w++) {
              chart[h][w]=chart2[h][w];
          }
      }
  }
  int main() {
      ......
          else
          {
              rotate90;
          }
      }
  }
  </code></pre>