title: Input validation using a function in C
body: <p>I'm validating user input through functions.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void get_income(double *pschool, double *pincome);
  double get_double(void);
  
  main()
  {
      get_income(&amp;pschool, pincome);
  }
  
  void get_income(double *pschool, double *pincome) {
      int tuition, supplies;
  
      printf("Enter tuition:");
      scanf("%d", &amp;tuition);
      printf("Enter supplies:")
      scanf("%d", &amp;supplies);
  
      *pSchool = tuition + supplies;
      return;
  }
  
  double get_double(void) {
      // validation code should go in here 
  }
  </code></pre>
  
  <p>I need to validate the user supplied values for <code>tuition</code> and <code>supplies</code> to ensure they're both 0 or greater and not empty. Negative values or anything other than numeric digits should not be accepted.</p>
  
  <p>The validation code should be in the <code>get_double</code> function and I can't seem to figure out how I can validate something that resides in a separate function. Looking for guidance please.</p>