What are the different data types of arrays in C#?

CsharpProgrammingServer Side Programming

With C#, you can create an array of integers, chars, etc. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type stored at contiguous memory locations. This type can be integer, char, float, etc.

The following is an array declaration showing the datatype usage −

datatype[] Name_of_array;

Here,

datatype is used to specify the type of elements in the array.

[ ] specifies the rank of the array. The rank specifies the size of the array.

Name_of_array − specifies the name of the array.

Set the integer array −

int[] a;

Set the double array −

double[] z;
raja
Published on 09-Aug-2018 11:15:00
Advertisements