title: How should I call other function's value to another function's condition statement?
body: <p>I am trying to create two functions and put them outside the main{ }.</p>
  <p>The question requires the user to enter a number that should be <code>end_size &gt; start_size &gt; 9</code>.</p>
  <p>And if not just prompt it again.</p>
  <p>I have two questions.</p>
  <p>Here is the first problem, in function <code>int get_start_size</code>, the function should be stored the value in <code>int start_size</code>. Then, why I cannot call it from another function <code>int get_end_size</code>?</p>
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
  int get_start_size(void);
  int get_end_size(void);
  
  
  int main(void)
  {
  
      int i = get_start_size();
      printf(&quot;%i\n&quot;, i);
      
      int j = get_end_size();
      printf(&quot;%i\n&quot;, j);
      
  }
  
  
  int get_start_size(void)
  {
      
      int start_size;
      do
      {
          start_size = get_int(&quot;Start size is:&quot;);
          
      }
      while (start_size &lt; 9);
      return start_size;
  }
  
  
  int get_end_size(void) 
  {
      
      int end_size;
      
      do
      {
          end_size = get_int(&quot;End size is:&quot;);
          
      }
      while (end_size &lt; start_size); //&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;this is the alert I got, use of undeclared identifier 'start_size'.
      return end_size;
  }
  
  </code></pre>
  <p>And the second problem is if I change it like this:</p>
  <pre><code>int get_end_size(void) 
  {
      
      int end_size;
      int k =  get_start_size(); //&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Should I call function like this?
      do
      {
          end_size = get_int(&quot;End size is:&quot;);
          
      }
      while (end_size &lt; k); //this is the problem I got, how to use value &quot;int s&quot; from other function &quot;int get_start_size(void)&quot;?
      return end_size;
  
  }
  </code></pre>
  <p>The result will be like this:</p>
  <pre><code>~/lab/ $ ./population 
  Start size is:10
  10
  Start size is:10 //duplicated prompt
  End size is:22
  22
  ~/lab/ $ 
  </code></pre>
  <p>The result quite meet my goal, but I think I called the function in the wrong way because it asks the user to enter two times the start size. How should I do it instead? Thanks.</p>