How to create int array with specific size in C#

1 Answer

0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		int[] array = new int[7];
		
		array[0] = 234;
		array[1] = -8;
		array[2] = 98;

		for (int i = 0; i < array.Length; i++) {
			Console.Write(array[i] + " ");
		}
	}
}




/*
run:
  
234 -8 98 0 0 0 0 
  
*/

 



answered Sep 22, 2023 by avibootz
...