Skip to content
Justice Tech School

C# Arrays

An array holds a fixed number of values of one type. Indexes start at 0. Length gives the size, and Array.Sort and Array.Reverse change order.

Example
int[] nums = { 5, 2, 9, 1 };
Array.Sort(nums);
Console.WriteLine(string.Join(",", nums));
Console.WriteLine(nums.Length + " " + nums[0]);
int[] zeros = new int[3];
Console.WriteLine(zeros[1]);

Exercise

First index.

nums[]

Quiz Test

What is the first array index?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.