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...

Understanding Distribution

Distributed presence means that more than one object is there. Also, these objects are situated at more than one location.  One object may establish communication with another object. The first object may deliver some message. The message can be received by another object. It can be said that object distribution is successful, as one object has succeeded in delivering a message. The second object has successfully received the message. Two objects are at a distance. Communication brings them closer. The successful communication has served to highlight that the idea of distribution is meaningful. Distribution helps exchange of information. Many different objects can form a group.  Two groups can occupy different locations.  It may happen that at a particular location there are several objects. But, all these objects talk among themselves.They talk among themselves and make things happen.  There is a resultant of this talk process. All the communicating objects  at...

Message Switching

Message is a piece of information. Switching means movement.  In a Network there are a number of nodes. Nodes are vital junctions of a Network. Message Switching means transmission from one node ( one point ) of a Network to another node ( another point ). So, transmission is from point to point. Transmission from one point to another point is a single hop ( jump ). Message Switching means switch over of a Message. In one step of Message Switching,  Message switches over from one node to another.  The two nodes involved in a Switching operation are on the same Network. It cannot be that the beginning node ( source node) is on one Network and the second node ( sink node ) is on a different Network. In a point to point ( one junction to another junction ) transmission, a Message travels a part of its journey. Message moves from previous point to next point. The Network is Point-to-Point Network. A Switching activity means movement of a message. Indeed, the Message has mov...