title: Reading an array with floating point numbers (C programming language)
body: <p>I am creating a function to read in inputs from the user and put them into a floating point array of numbers with predetermined fix size of 25.  It also returns the total amount of items that the user enters.  However, for some reason this code will not terminate when I enter 999.  I know it is something to do with that it is an int and input is a float, but I don't really know how to fix this (only been learning C for five days).  </p>
  
  <pre><code>int readArray(float a[]){
      //accepts inputs and puts items in a predefined array of size 25    
      int index = 0;
      float input;
      printf("Enter 25 or less elements for array (999 to finish):\n");
  
      scanf("%d", &amp;input);  //accept initial response; priming prompt
      printf("1st Prompt accepted");
  
      while (input != 999 &amp;&amp; index &lt; 25) {
          printf("In while loop");
  
          a[index] = input;
          index++;
          scanf("%d", &amp;input);
      }
      return (index);
  
  }
  </code></pre>