How to declare an array of N integers in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        int N = 5;
        int[] array = new int[N];

        foreach (int n in array) {
            Console.WriteLine(n);
        }
    }
}




/*
run:

0
0
0
0
0

*/

 



answered Jul 29, 2021 by avibootz
...