0% found this document useful (0 votes)
13 views

Arrays

This document discusses different types of arrays in C#, including that array indexes start at 0, arrays can be fixed-length or dynamic, and the main types are single-dimensional, two-dimensional, and jagged arrays. Single-dimensional arrays are declared with a size, two-dimensional arrays have rows and columns, and jagged arrays have multiple inner arrays of different lengths.

Uploaded by

Saidulu Vuyyala
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Arrays

This document discusses different types of arrays in C#, including that array indexes start at 0, arrays can be fixed-length or dynamic, and the main types are single-dimensional, two-dimensional, and jagged arrays. Single-dimensional arrays are declared with a size, two-dimensional arrays have rows and columns, and jagged arrays have multiple inner arrays of different lengths.

Uploaded by

Saidulu Vuyyala
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6

In C#, an array index starts at zero. That means first item of an array will be stored at 0th position.

The position of the last item of an array will total number of items - 1.

In C#, arrays can be declared as fixed length or dynamic. Fixed length array can store a predefined number of items, while size of dynamic arrays increases as you add new items to the array.

Types of Arrays -Single Dimensional Arrays -Two Dimensional Arrays -Jagged Arrays

Single Dimensional Arrays: <type>[] <name>=new <type>[size]; int[] arr=new int[4]; or int[] arr; arr=new int[5]; or int[] arr={list of values};

Two Dimensional Arrays: <type>[,] <name>=new <type>[rows, cols]; int[,] arr=new int[3, 4]; or int[,] arr; arr=new int[2, 3]; or int[,] arr={list of values};

Jagged Arrays: <type>[][] <name>=new <type>[rows][]; int[][] arr=new int[3][]; or int[][] arr={list of values};

You might also like