title: error: use of undeclared identifier
body: <p>I'm trying to run this code, but I keep getting:</p>
  
  <pre><code>:21:20: error: use of undeclared identifier 'r'
  for(int s = h - r; s &gt; 0;s--)
  </code></pre>
  
  <p>but I can't seem to figure out why I'm getting the error. Can anyone help me out here?</p>
  
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(void)
  {
      int h;
      do
      {
          printf("please give me a positive int between 1 and 23: ");
          h = GetInt();
      }
      while (h &lt; 1 || h &gt; 23);
      //get int and store it 
  
  
      for(int r = 0; r &lt; h; r++)
      {
          printf("#");
      }
  
      for(int s = h - r; s &gt; 0;s--)
      {
          printf(" ");
      }      
  }
  </code></pre>