when i declare local variable x and use it in array,the error is occure that use of un assign local variable.kindly help me
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
namespace ConsoleApplication11
{
class Program
{
staticvoid Main(string[] args)
{
int x;
Console.Write("enter how many entries you want");
Console.ReadLine();
int[] randomNum = newint[x];//here problm is occuring
Random RandomNumber = new Random();
int counter = 0;
for (int i = 0; i < x; i++)
{
randomNum[i] = RandomNumber.Next(1, x);
}