Introduction of Array

An array is a data structure that is used collect multiple variables of the same data type together into one variable. Rather than having separate variable names for many different integers, for instance, you could collect all of them together into one variable. This does not mean that you will want to have all of the integers in any program united into one integer array. However, there will often be times when certain integer variables are all related to one another in a way appropriate for an array. 



The key thing to understand about arrays is that the data is collected together so that any element in the array can be accessed from the array using an index. Basically, you can think of an array as a list of elements where each of the elements has a unique place in the list, such as 1st, 2nd, or 25th. You can access any element from the list using its location in the list. Arrays can also be used as unordered sets, which are lists where the order is unimportant.

Basic Operations :
Following are the basic operations supported by an array.
  • Traverse - print all the array element one by one.
  • Insertion - Adds an element at the given index.
  • Deletion - Deletes an element at the given index.
  • Search - Searches an element using the given index or by the value.
  • Update - Updates an element at the given index.
Array is initialized with size, then it assigns defaults value to its elements in following:
Data TypeDefault Value
boolfalse
char0
int0
float0.0
double0.0f
void
wchar_t0
Operations:
  • Deletion
Introduction of Array Introduction of Array Reviewed by Tech Specifier on May 09, 2020 Rating: 5

No comments:

Powered by Blogger.