title: An unhandled exception of type 'System.IndexOutOfRangeException' occurred
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace ovning_grunder5._1
  {
      class Program
      {
          static void Main(string[] args)
          {
              string input;
              int[] tal1;
              int i = 0;
              int count = 0;
              int large = 0;
              Console.WriteLine("Mata in tal och avsluta med 0");
              input = Console.ReadLine();
              while (input != "0")
              {
                  tal1[i] = Convert.ToInt32(input); //Error Occurres here after the second input is given.
                  input = Console.ReadLine();
                  i++;
                  Console.WriteLine(tal1[i]);
              }
              while (tal1[count] &lt;= i)
              {
                  if (tal1[count] &lt; large)
                  {                        
                      large = tal1[count];
                  }
                  count++;
              }
          }
      }
  }
  </code></pre>
  
  <p>When I run the program, I add input breaks in my program and gives the error <code>"An unhandled exception of type 'System.IndexOutOfRangeException' occurred."</code> Does anyone know how to fix this?</p>