answersLogoWhite

0


Best Answer

Advantages:

1. Can store "n" number of same data types in different indexes

2. Can be accesses using reference.

Disadvantage:

1. No boundary check, if the array boundary is crossed run time

2. No facility to increase the size of array in Run time

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

The only advantage I can think of using an array (a collection that with a fixed size) is the initialization of each element in that array is set to the default value when the array is created (allocated), while a List (or a collection) with size can change does not get initialized to the default value even you set an initial size to it.

For example:

int[] array = new int[20]; // all 20 elements are 0, the default value of int

Exception[] errorArray = new Exception[10]; // all 10 elements are null

List<int> integerList = new List<int>(20); //cannot access to integerList[0] unless integer[0] has been explicitly assigned with a value, or integerList.Add() has been called at least once without being cleared

The disadvantage of using an array is the objects are being referenced/stored within, which may not easily being cleared, especially for those reference types.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the advantages and disadvantages of arrays in c sharp?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What are the advantages c sharp?

it can fly


What is the Advantages and disadvantages of server side includes?

c


What are the advantages and disadvantages of using a DVD storage device?

c


What is the required syntax for creating C arrays?

The required syntax for creating C arrays include the brackets, array size, variety length arrays, codes like std:vector, classPTR, and many more to create C arrays.


What are the notes to?

A sharp G G E sharp G E sharp A sharp A sharp C C A sharp C E sharp G A G E sharp A sharp A sharp A sharp G E sharp C this is not on the Flute btw idk what instrument its on


What are the notes to fireflies?

A sharp G G E sharp G E sharp A sharp A sharp C C A sharp C E sharp G A G E sharp A sharp A sharp A sharp G E sharp C this is not on the flute btw idk what instrument its on


How do you play Simpson theme on keyboard?

here it is C,E,F SHARP,A,G,E,C,A,F SHARP,F SHARP,F SHARP,G,A SHARP,C,C,C,C


What is an arrays in c?

array is collection of many data


What are some of the benefits of programming in C Sharp?

There are many advantages to C sharp programming like: Not having to define the Headers (.h), Classes can be defined within classes, classes and functions can be defined in random order unlike C and C++, Classes and functions don't need to be declared in the program.


What key signature has G sharp B sharp and C sharp?

C# Major


What is the purpose of using arrays in C language?

The purpose of using arrays in C is to store multiple values in one variable. Then you can make programs that use arrays like lists, printing values from multiple arrays into one line. It take memory in continues block then we can know memory location easily. We can retrieve data quickly.


What are the notes for the c sharp harmonic scale?

C sharp, D sharp, E natural, F sharp, G sharp, A natural, B sharp &amp; C sharp We call the note C "B sharp" to avoid using the same letter name twice. If we used the note name "C" we would have 2 C-notes and no B-notes in the scale!