메서드를 사용하여 배열을 채우지 만 메서드를 사용하여 구멍 배열을 할당하려고 할 때와 메서드에서 채워진 배열을 반환 할 때 같은 문제가 2 개 발생합니다.Array-Method 디버깅 문제
나는 문제가있는 줄
static void Main(string[] args)
{
uint n = uint.Parse(Console.ReadLine());
uint m = uint.Parse(Console.ReadLine());
int[,] array=new int [n,m];
array=FillArrayMethodC(n,m); //Cannot implicitly convert type 'int' to 'int[*,*]'
}
static int FillArrayMethodC(uint n, uint m)
{
int[,] a=new int [n,m];
//fill the array
return a; //Cannot implicitly convert type 'int[*,*]' to 'int'
}
에 오류가 명시 적 의견을 추가 한 어떻게 전체 배열을 반환하고 할당하는 적절한 방법!
당신의 도움이 BR
왜 [,]'대신'int'의'FillArrayMethodC'하지'INT의 반환 형식이 : 난 당신이 뭔가를 원하는 것으로 의심? –
Kirk의 의견은 완전히 옳습니다. 어쨌든, 당신이하려는 일을 이해하지 못합니다. – LaGrandMere
메소드를 사용하여 배열을 채우기 만하면됩니다! – kidwon