An array is a series of elements of the same type placed in contiguous memory lo
cations that can be individually referenced by adding an index to a unique ident
ifier. For example, an array representing 10 height measurements (each being an integer quantity) may be defined as: int heights[10]; The individual elements of the array are accessed by indexing the array. The fir st array element always has the index 0. Therefore, heights [0] and heights [9] denote, respectively, the first and last element of heights. Each of heights ele ments can be treated as an integer variable. So, for example, to set the third e lement to 177, we may write, heights[2] = 177; //Reverse Order #include<iostream.h> #include<conio.h> int a[6],i; void main() {clrscr(); cout<<"Enter any five integers\n"; for(i=1;i<=5;++i) cin>>a[i]; cout<<"Reverse order\n"; for(i=5;i>=1;--i) cout<<a[i]<<" "; getch(); } Notes: Array starts with index 0. So, int a[5] defines an array with 0 to 4 elem ents (Total=5 elements). So, if we wish to use index (i) from 1 to 5, we need at least 6 elements. So, int a[6] is used. Here, in this example, we literally don t use the 0th element. ie. a[0]. //Linear Search #include<iostream.h> #include<conio.h> int a[50],n,i,j,e; void main() {clrscr(); cout<<"Enter integers(elements) at end give 0"<<endl; for(i=1; ;++i) {cin>>a[i]; if(a[i]==0) break; } n=i-1; cout<<"Enter elemt you want to search "; cin>>e; for(i=1;i<=n;++i) if(a[i]==e) break; if(i==n) {cout<<"NOT FOUND";return;} cout<<"FOUND at "<<i; getch(); }