title: C: Function not returning value to main
body: <p>I want to get the value of "length" input with the get_length function to be sent up to main, but I get an error on the printf statement following get_length(); in main. Apparently it's tossing away whatever is entered with scanf. How do I make it keep the new value entered by the user? </p>
  
  <pre><code>void get_length(int length);
  int main(int argc, char * argv[])
  {
  int length;
  int width;
  int area;
  get_length();
  printf("The length of the rectangle is %d.\n", length);
  return 0;
  }
  
  void get_length(int length)
  {
  printf("Please enter the length for a rectangle: ");
  scanf("%d", &amp;length);
  
  while(length &lt; 1)
  {
      printf("Enter a positive number.\n");
      scanf("%d", &amp;length);
  }
  return;
  }
  </code></pre>