;

Thursday, 23 April 2015

Arrays

Arrays
An array is a group of consecutive memory locations with same name and type. Simple
variable is a single memory location with a unique name and a type. But an array is a collection of different adjacent memory locations. all these memory locations have one collective
name and type. the memory locations in the array are known as elements of array. The total number
of elements in the array is called its length.
Each elements in the array is accessed with references to its positions of location in the array. This
positions is called index or subscript.Each elements in the array has a unique index. The index
of first element is  0 and the index of last is element length is -1. The Value
the index written in brackets along with the name of array.
Arrays are used to store a large amount of similar kind of data. Suppose the user wants
to store the marks of 100 students and declares 100 variables. It is time consuming process to
use the these variables individually. This process can be simplified by using array. An array is
of 100 elements can be declared to store these values instead of 100 individual variables.

Array initializations
The process of assigning values to array elements at the time of array declaration is called
array initialization. This process provides a list of initial values of array elements. The value
are separated with commas and enclosed within braces. there must be at least one initial
value between braces. A syntax errors occurs if the value in braces are more than length of array
. So if the number of initial values is less than the array sizes the remaining array elements
are initialized to zero.

Declaring one dimensional arrays
A type of array in which all elements are arranged in the form of list is known as
on dimensional array. It is also called single dimensional array or linear list. It consists
of one column or one row. The process of specifying array name length and data type is called
array declaration.

Share this post to

FacebookTwitterGoogle BuzzStumnleuponDeliciousDiggTechnorati

Comments From Facebook
Subscribe Us

Get free daily email updates!

Follow us!

0 comments:

Post a Comment