Answer the question
In order to leave comments, you need to log in
Why does it give the error "Cannot implicitly convert type 'int[]' to 'char[]"?
Аргументом метода символьный массив, метод возвращает ссылку на массив чисел символов.
using System;
class ArgArray
{
static char[] SymbsArr(char[] n)
{
int[] numbs = new int[n.Length];
for (int i = 0; i < numbs.Length; i++)
{
numbs[i] = (int)n[i];
}
return numbs;
}
static void Main()
{
char[] symbs = { 'A', 'B', 'C', 'a', 'b', 'c' };
int[] numbs;
numbs = SymbsArr(symbs);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question