Skip to main content

Arrays: A Look At

 An array is an ordered collection of elements. Each element of the array is assigned a value. An array element can be considered as a variable. All the elements of the array are indexed. Zero and whole numbers are used as indices. Indexing of the array elements is purposeful. It helps to identify the array elements uniquely.

An array-name is associated with each array. The array-name once tagged, comes to be associated with each array element. In other words, the array-name becomes part and parcel of the identity of all the array elements.

In such a scenario, when the same array-name  applies to each array element, the unique index of each element gives the required uniqueness. This uniqueness is acquired by each and every array element. In this way identification of the array elements is helped. In order words, uniqueness is  bestowed  upon  the array elements with the help of indices.

Distinctiveness of array elements helps in data processing. We are able to specify the required array element very easily. Data processing techniques can be suitably chosen and we can get the output of array processing.

We can form an array of four integer values. Let us say, we are given four integer values: 4, 5, 9, 7. We can form an array out of the four values. This can be performed as:

///////////////////////////////////////////////////////////

int x[4]; //declaration of 4 element array

//int denotes Integer

//x denotes array-name

//'4' signifies indices: 0, 1, 2, 3

x[0] = 4; //1st array element

x[1] = 5; //2nd array element

x[2] = 9; //3rd array element

x[3] = 7; //4th array element

////////////////////////////////////////////////////////////

Association of Data Type with the  array elements is performed firstly. Such association leads to formation of an array. The formed array can hold values, as indicated by the Data Type. 

Let us suppose that an  array is related to a Data Type, say, Integer ( int ). So, all the array elements can only hold only integers. 

We can note that the index of the first array is '0'. The index of the fourth array element  ( last element ) is '3'. The four array indices are: 0, 1, 2, 3. The presented indices are in sequence. The value held by the second array element, denoted by 'x[1]' is '5'. Similarly, the value held by the last array element, denoted by 'x[3]' is: '7'.

Acquisition of a value that is other than integer by an array element is a serious mistake. It is indicated as an error. We must exercise caution in this respect. We must not assign a value to an array element that is not in agreement with the type of Data associated with the array.

_______________________

_______________________

Goodbye!

Have a great day!!

_______________________

_______________________














Comments

Popular posts from this blog

Interface Message Processor ( IMP )

Interface Message Processor ( IMP ) is a special purpose Computer. The Processor plays a vital role in Host-to-Host communication. IMP is placed between Host Computers.  IMP helps Hosts to exchange information. IMPs ( Interface Message Processors ) form a group. The group dedicates itself towards reliable transmission of Packets. _________________________ Note: An Interface Message Processor can be supposed to have a face. Firstly this supposed face of IMP is in the direction of the first Host, which sends the  message. Secondly, this face is turned towards the other Host.  Now, the IMP,  with its face turned around, communicates with this other Host.  Transformed message from IMP is communicated to this Host. __________________________ Message ( a piece of information ) sent from the Host ( source of information  ) is transformed into Packets. Transformation of the message into Packets is performed by an IMP. These Packets are forwarded to the receiver H...