title: How to normalize data and clear array
body: <p>Hi i've written a small program that let's me choose from a menu what i want to do ie view, enter values, compute etc. its doing most of the stuff im asking it, so im on the right track. However, there are a few things i dont know how to fix. </p>
  
  <ol>
  <li><p>when i enter values and exit. When i re-enter it starts from 0 again, as if everything cleared. I want to start off where i left off. Secondly. i want to have MAX 10 values as input. I should not be able to keep entering. I want to erase the array using my function instead. </p></li>
  <li><p>im trying to compute normalized values but program quits everytime. </p></li>
  </ol>
  
  <hr>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define LENGTH 10
  
  int enterMeasurements();
  void printArray();
  int minValue();
  int maxValue();
  float avgValue();
  void normValue();
  
  int main(void)
  {
     char input;
     int nrMeasurements=0;
     int arrayTable[LENGTH] = {0};
     int normTable[LENGTH] = {0};
     int max, min, norm;
     float avg;
     //main menu
     do
     {
  
        printf("\nMeasurement tool 1.0\n");
        printf("V for (View)\n");
        printf("E for (Enter Values)\n");
        printf("C for (Compute Values)\n");
        printf("R for (Reset Values)\n");
        printf("Q for (Quit)\n");
        printf("\nEnter input: ");
        scanf(" %c", &amp;input);
  
        if(input == 'v' || input == 'V')
        {
           // function to print array values
           printArray(arrayTable, nrMeasurements);
        }
        else if(input == 'e' || input == 'E')
        {
           // enter values here
           nrMeasurements = enterMeasurements(arrayTable,nrMeasurements);
        }
        else if (input == 'c' || input == 'C')
        {
           // enter function to calc min, max and avg and prints it.
           max = maxValue(arrayTable, nrMeasurements);
           min = minValue(arrayTable, nrMeasurements);
           avg = avgValue(arrayTable, nrMeasurements);
           printf("Maximum value is: %d\n", max);
           printf("Minimum value is: %d\n", min);
           printf("Average value is: %.2f\n", avg);
           normValue(normTable, nrMeasurements);
  
  
        }
        else if (input == 'r' || input == 'R')
        {
           // enter function that erase the entire array.
           printf("[   erase array   ]\n");
        }
     }
     while (input !='q' &amp;&amp; input != 'Q');
     return 0;
  }
  
  int enterMeasurements(int arrayTable[], int nrMeasurements)
  {
     int i;
  
     for (i = 0; i &lt; LENGTH; i++)
     {
        printf("Enter Measurement #%i (or 0): ", i+1);
        scanf("%d", &amp;arrayTable[i]);
  
  
        if (arrayTable[i] == 0 )
           break;
     }
     return i;
  }
  
  void printArray(int arrayTable[], int nrMeasurements)
  {
     int i;
  
     for (i = 0; i &lt; nrMeasurements; i++)
     {
        printf(" array[%2d] : %d\n", i, arrayTable[i]);
     }
  }
  
  int maxValue(int arrayTable[], int nrMeasurements)
  {
     int i, max;
     max = arrayTable[0];
     for (i=1; i&lt;nrMeasurements; i++)
     {
        if (arrayTable[i]&gt;max)
        {
           max=arrayTable[i];
        }
     }
     return(max);
  }
  
  int minValue(int arrayTable[], int nrMeasurements)
  {
     int i, min;
     min = arrayTable[0];
     for (i=1; i&lt;nrMeasurements; i++)
     {
        if (arrayTable[i]&lt;min)
        {
           min=arrayTable[i];
        }
     }
     return(min);
  }
  
  float avgValue(int arrayTable[], int nrMeasurements)
  {
     int sum,i;
     float avg;
     sum=0;
     avg=0;
  
     for (i=0; i&lt;nrMeasurements;i++)
     {
        sum=sum+arrayTable[i];
        avg=(float)sum/(i+1);
     }
     return(avg);
  }
  
  void normValue(int min, int max, int avg, int arrayTable[], int nrMeasurements, int normTable[])
  {
     int i;
  
     for (i=0; i&lt;nrMeasurements; i++)
     {
        normTable[i]=(arrayTable[i]-min)/ (max-min);
     }
     for (i=0; i&lt;10; i++)
        printf("Normalized Values: %d\n", normTable[i]);
  }
  </code></pre>