We define arrays as a finite collection of homogenous elements. It means that an array is able to store similar type of items i-e either all integer numbers, all floating numbers, all characters, string etc. but the entire data item should be of same type
Some important points about Array:
· First element of an array has zero index.
· All the data items in array are always stored in consecutive memory locations.
· Arrays are always store under a common heading or a variable name
· An array either be an integer, character, or floating point data item but initialized only on declaration time not afterwards.
· An array can always be read or write through loops
CLASSIFICATION OF AN ARRAY:
There are basically two types of an array:
1. One dimensional array.
2. Two dimensional array.
One dimensional array:
In one dimensional array; only one subscript specification is required to specify a particular element of an array. It can be declared as follow:
data_name variable _name [expression];
Data_name indicates the type of elements to be store in that array, var_name indicates the name of that array and expression indicates the number of items to
be store in that particular array.
That subscript is also known as the size or length of an array and it must be
an integer value.
For example:
int a[9];
It means that a be a integer type array which can store almost 9 elements of integer type and the index starts from zero i-e
a[0], a[1], a[2], -----------------------------------a[8]
And the size of an array is= (upper bound- lower bound) +1 i-e
The size of this array is (8-0) + 1 i-e 9.
ACCESSING ONE DINENSIONAL ARRAY:
An array can be access through loops. For one dimensional array we require only one loop i-e
TWO DIMENSIONAL ARRAYS:
Two dimensional arrays are as a grid. If we have 5 rows and 5 columns then for accessing total 25 elements we required 2 dimensional arrays
Two dimensional arrays can be initialized as:
Int b[3][4]
The first number in the bracket states the number of rows and the second number in the bracket states the number of columns
The meaning of above example is:
'b' is a integer type array having 3 rows and 4 columns.
ACCESSING TWO DIMENSIONAL ARRAYS:
For accessing two dimensional arrays we require two loops.
Published by Harsh Gupta - Tech Writer
I am a part time freelancer and writing is my hobby Some of my websites: http://www.GenericArticles.com http://www.JailBreakingiPhone.com View profile
- Exploitation of Parallelism in Algorithms on Systolic ArraysIn many scientific and signal processing applications, there are increasing demands for large volume and/or high speed computations, like parallelism in algorithms.
- JavaScript ArrayIn JavaScript an array is an object that would hold a list of items. Each item is a literal or a variable representing a literal. In this article I explain the JavaScript Array.
- PHP Array In PHP an array is an ordered map where values are associated to keys. I explain all that in this article and how to use a PHP array.
- What is the Difference Between OLAP and OLTP?A brief look at the significant differences between transactional databases and analytical processing databases, which are used most frequently in data warehouses.
Dirty Wind Gusts Gigawatts of PowerInventors layout a roadway system that can provide the basis for a national or global clean or renewable energy infrastructure.
- JavaScript Two Dimensional Array
- JavaScript Multi-Dimensional Array
- Tutorial - Declaring Array in JAVA
- A Multidimensional Array for Horizontal Web Page Menus
- Classification of Data Structure
- Multidimensional Arrays in Perl 5.0: A Boon to Bioperl (Part 1)
- Java Sorting Algorithm
- We define arrays as a finite collection of homogenous elements.
- First element of an array has zero index.
