Search This Blog

Thursday, 14 March 2013

Arrays in c


ARRAYS
Purpose:

Definition:

Array Initialization:

Types of Arrays:

Examples:

Interview Questions:


 Purpose:

Need of Arrays ?

Here to bettter Understand this we rewind Variables concept  in a variable at any given time we can store only one value.

For Example int a=1;    


Here value of a is 1.

Suppose if we want to store multiple values  2,3,4,5 into the variable a is not possible.

Example: int a=1,2,3,4,5(WRONG)

i.e we cannot store multiple values into a single variable For that we need to create separate variables for individual values like

int b=2;

int c=3;

int d=4;

int e=5;
Suppose in our program there are 1000 values to store  then we need  to create 1000 variables .it is very difficult ,and it increases complexity also.To overcome the drawback of this we go for arrays.

·        In Arrays We can store multiple values at a time.                      

Defination:

Array is a collection of similar (Homogeneous) data elements which are stored in sequential memory locations’ and all are referred by a common name.

Types of an Array
       
       1.    Single/One Dimensional  Array. 
       2.     Two Dimensional Array 
       3.     Multi Dimensional Array.

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Hostgator Discount Code