!!!Please Explain Me An Array!!!
By kingadnan
@kingadnan (1538)
Pakistan
January 17, 2007 1:58pm CST
Please friends Explain me an array i am really confused, tell me all types of an array....please
7 responses
@dholey (1383)
• India
22 Jan 07
array is a group of homogeneous variables , where every variable of that group has common name (name of the array) and ever variable of the array has a unique element number(also known as element number/index no/subscript number), in c/c++/java the element number always begins with 0 (but in some languages like foxpro it starts with 1 too) , when only the array name is mentioned , it stands for the base address of tht array , i.e. the address of very first(zeroth) element of tha arry, when we specify array name along with element number that means we have specified the actual name of that variable (of the array), in c/c++ the array notations are converted into pointer's notation (see example)
LOPS ARE THE BEST WAY FOR WORKING WITH ARRAYS.
lets have an example
int x; // for loop
int ar[5] ; /* THERE ARE 5 VARIABLES OF INT WITH THE COMMON NAME ar
the first variable's actual name will be ar[0] so last will be ar[4]
so*/
ar[2] =10 ; /* WILL ASSIGN 10 IN 2ND ELEMENT OF THE ARRAY REMEMBER CONTER BEGINS
WITH 0
INTERNALLY IT WILL BE TAKEN AS *(ar+2) = 10*/
for(x=0;x
1 person likes this
@tmaheshwari (170)
• India
21 Jan 07
In computer programming, a group of homogeneous elements of a specific data type is known as an array, one of the simplest data structures. An array is similar to, but different from, a vector or list (for one-dimensional arrays) or a matrix (for two-dimensional arrays). Arrays hold a sequence of data elements, usually of the same size and data type. Individual elements are accessed by their position in the array. The position is given by an index, which is also called a subscript. The index usually uses a consecutive range of integers, (as opposed to an associative array) but the index can have any ordinal set of values. Some arrays are multi-dimensional, meaning they are indexed by a fixed number of integers, for example by a tuple of four integers. Generally, one- and two-dimensional arrays are the most common.
@mythmoh (3984)
• United States
17 Jan 07
array is a collection of similar items under a common name.for example if you want to enter 100 students marks then you may need 100 different variables.it will occupy space and will make the program more complicated.simple way is use array.give the name as mark.All marks will be from 0-100 means take it as integer(if no floating points otherwise take as float)then with the help of the index number you can point the student's marks.for example mark[1] is the first student's mark,mark[2]-second student etc.there are various types one dimensional,two dimensional,multi dimensional.
@hobohobo (678)
• Indonesia
20 Jan 07
Array in programming, mean a series of objects which all of them are have the same type. Each object in an array is called an array element. For example, you could have an array of integers or an array of characters or an array of anything that has a defined data type. The object that was in array are indexed and each object can be an independent object.
The important characteristics of an array are:
Each element has the same data type (although they may have different values).
The entire array is stored contiguously in memory (that is, there are no gaps between elements).
Arrays can have more than one dimension. A one-dimensional array is called a vector ; a two-dimensional array is called a matrix.
@uramit2003 (898)
• India
3 Mar 07
Hi Dear
Array is nothing but a collection of data of having simillar property(same type of data). further that collection is stored in a congious memory alocation (one after another). what ever be the dimention they will be allocated in order one bye one. in case of two dimension order can be row major form or column major form that depends upon implementation.
@ritwikghoshal (405)
• India
12 May 07
int a[10];
char name[20]; // declaration
otherwise :::::
int a[5]={1,7,3,5,9};
char name[10]="kingadnan"; // initialization
taking input ::
for (i=0;i
@dj_faheem (738)
• Pakistan
2 Mar 07
aray is a group of homogenious data..........................................it is very useful in c programming
for example if u want to collect marks of 50 students of a class then u not take 50 vairables u just take array of 50 length and enter 50 student marks in it becuase marks data type are same
int marks[50};