When I put fixed values in the array size I can fill it up, but when I try to capture the values in arrays a message like this appears:
The index was outside the bounds of the array
' int a = 0, b = 0;
double[ , ] test = new double[a , b];
Console.Write("Linha: ");
a = int.Parse(Console.ReadLine());
Console.Write("Coluna: ");
b = int.Parse(Console.ReadLine());
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b ; j++)
{
Console.Write("Digite um valor: ");
test[i , j] = double.Parse(Console.ReadLine());
}
}
Console.WriteLine("\n\n ");
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
{
Console.Write(test[i, j] + " ");
}
Console.WriteLine(" ");
}
Console.ReadKey();'