Głupi błąd - cant find

0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double min;
            int  n, pos;
            double[] x;

            Console.WriteLine("Ile liczb zamierzasz podać?");
            n = Convert.ToInt16(Console.ReadLine());
          
            for (int i = 1; i == n; i++)
            {
                Console.WriteLine("Podaj kolejny element");
                x[i] = Convert.ToDouble(Console.ReadLine());
            }

            min = x[1];
            pos = 1;

            for (int i = 1; i == n; i++)
            {
                if (x[i] < min)
                {
                    min = x[i];
                    pos=i;
                }
            }
            Console.WriteLine("Najmniejsza liczba {0} na pozycji {1}",min,pos);
                
        }
    }
}

podkreśla mi "x[i] = Convert.ToDouble(Console.ReadLine());" i wywala, że niezdefiniowano x.

0

Nie zainicjowałeś tej zmiennej.
Po n = Convert.ToInt16(Console.ReadLine()); daj x = new double[n];

1 użytkowników online, w tym zalogowanych: 0, gości: 1