Embed presentation
Download to read offline



![Declaring Arrays
• To declare an array in C#, you can use the
following syntax:
• datatype[] arrayName;
• 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.
• arrayName specifies the name of the array.](https://image.slidesharecdn.com/c-161029100354/85/C-4-320.jpg)
![Initializing an Array
• Declaring an array does not initialize the array
in the memory. When the array variable is
initialized, you can assign values to the array.
• Array is a reference type, so you need to use
the new keyword to create an instance of the
array. For example,
• double[] balance = new double[10];
double[] balance = new double[10];](https://image.slidesharecdn.com/c-161029100354/85/C-5-320.jpg)

C# arrays allow storing a fixed number of elements of the same type in contiguous memory locations. Arrays are declared with a datatype followed by square brackets and a name, which reserves the memory but does not initialize values. Arrays must be initialized with the new keyword followed by the length to create an instance and allocate memory, at which point individual elements can be assigned values.



![Declaring Arrays
• To declare an array in C#, you can use the
following syntax:
• datatype[] arrayName;
• 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.
• arrayName specifies the name of the array.](https://image.slidesharecdn.com/c-161029100354/85/C-4-320.jpg)
![Initializing an Array
• Declaring an array does not initialize the array
in the memory. When the array variable is
initialized, you can assign values to the array.
• Array is a reference type, so you need to use
the new keyword to create an instance of the
array. For example,
• double[] balance = new double[10];
double[] balance = new double[10];](https://image.slidesharecdn.com/c-161029100354/85/C-5-320.jpg)
