Different Data Types of Arrays in C#



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;
Updated on: 2020-06-20T15:19:31+05:30

667 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements