Define Looping ,Arrays and expamples of Arrays


Looping is also called an iterative or repetative control mechanism , where int set of statements are repeatedly exacused either for a fixed number of times or as long as as certain logic condition is true .


The while , do -while and for loop statements are the 3 powerful loop control structurals available in C . The while statements is a pre-test loop statement ( it is executed if only the expression is true ) and the do-while is a post-test lop statement (it is executed at least one.Than the exepressions evalueted for repeating the loop).
The "for"loop is used when the user know the number of impressions to be made . Sometimes , it becomes desirable to exist a loop or skip a part ofb loop in an intative process.
To do so ,the break and continue statements are used.




Array

An array is a data structure used to store collection of similar values under a given name .They are also called subscriped variables .Elements of arrays are stored in the contiguous memory locations.

These elemensts are accessed by their name of the arrray followed by the subscript within brackets .
Like variables, array (s) must also be declared before they are used .

Data_type array_name[number of elements in array]
Where data type is a valid type (like int,float ...),name is a valid identifier and the elements feel (which  is always enclose in square brackets [] ), specifies how many of these elements the array has to contain . 

Entering Data into an  Array

Since array represents  a collection of values ,so to input data into the indiviual elements of the Array , we make us of loo statments . If the actual size of the array is known in advance, then for loop is preffered to while loop or do -while loop .

Accessing the values of an Array 

In any point of the program in which an array is visible ,we can access the values of its elements indiviually as if it was a normal variable , thus being able to both read and modify its value .The format is simple as :

                          name[index];                               



There are 2 types of Arrys :
1.One dimension array 
2. Multi-dimensional arrays

One pair of square brackets is used for each (1) one dimensional array dimension. 
For example: one dimensional arrays has only one subsscript and it  is viewed as row matrix or column matrix, 
But , multi-dimensional arrays have more than one subscript , hence the name two -dimensional arrays and three -dimensional arrays and so on.
C does not supports strings .Data types but strings are handled as an array of characters .There is rich library of function for manipulating strings .





Declaration of two-dimensional Arrays 




In C language,the syntax used to define 2-D or Dim array is :

       data type_array_name[row][column]: