C
C
Chipu2018-06-24 12:42:46
C++ / C#
Chipu, 2018-06-24 12:42:46

Named argument specifications must appear in all specified fixed arguments. Where is the mistake?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp140
{
    class Program
    {
        static int Combin2(int n, int k, ref int[,] chest)
        {
            // N => K => 0
            if (chest[n, k] == 0)
            {
                if (n == k || k==0)
                {
                    return 1;
                }

                return Combin2(n - 1, k, ref chest) + Combin2(n - 1, k - 1, ref chest);
            }
            else
            {
                return chest[n, k];
            }




        }

        //
        static void Main(string[] args)
        {
            int[,] chest = new int[20,20];
           //эта строка вызывает ошибку
            Combin2(n: 4, k: 2, ref chest);
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nemiro, 2018-06-24
@Chipu

// добавить chest
Combin2(n: 4, k: 2, chest: ref chest);
// либо не указывать имена
// Combin2(4, 2, ref chest);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question