title: (C) Allow infinite of numbers to be entered, reverse the order of entered numbers & end program when 0 is entered
body: <p>I'm working on a project at the moment where I have to allow a user to enter an infinite amount of numbers and reverse the order of those entered numbers and end the program if 0 is entered. I did something similar, except the one I did set the amount of numbers the user could enter, so for example in the code below, I allowed the user to enter only three numbers, reverse the order and end when -1 is entered.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define MAX 3 // Defining max amount of numbers to be entered to 3
  main()
  {
      int numbers[MAX], i, end;
      printf ("Please enter %d integers:\n", MAX);
          for (i = 0; i &lt; MAX; i++){
           scanf("%d", &amp;numbers[i]);
           if (numbers[i]==-1){ // Loop ends when -1 is entered
            for (end=i; end&lt;MAX; end++)
             numbers[end]='\0'; // Nulls the value of blank locations in the array
          i=MAX;  
           }
          }
      printf ("\nThe values in reverse order are:\n");
      for (i = MAX-1; i &gt;= 0; i--)
      {
          if(numbers[i]!='\0') // Will not print null values in the array
          printf("\n%d ", numbers[i]);
      }
      return 0;
  }
  </code></pre>
  
  <p>How can I go about achieving this? I'm guessing I won't be able to use an array, and I'm pretty new to this so...</p>