Возвращение массива из метода - C#
Формулировка задачи:
using System;
class MatrixMultiply {
static void Main() {
[B]int[,] a;
a = Input(dst)[/B];
int[,] b = { { 5, 6 }, { 7, 8 } };
}
private static void Input(int[,] dst) {
int[,] a = new int[2, 2];
for (int r = 0; r < a.GetLength(0); r++) {
for (int c = 0; c < a.GetLength(1); c++) {
Console.Write("Enter value for [{0},{1}] : ", r, c);
dst[r, c] = int.Parse(Console.ReadLine());
}
}
Console.WriteLine();
}
}Решение задачи: «Возвращение массива из метода»
textual
Листинг программы
public static void Main()
{
int[,] mat = new int[3, 4]; // создание объекта, выделение памяти
Fill(mat); // вызов метода и передача матрицы для заполнения
}
public static void Fill(int[,] matrix)
{
// заполнение элементов матрицы
}