Declaring An Array

Description

How to Specify or Declare an Array ?

Comments
Would you like to comment?

Sign In if already a member, or Join Now for a free account.

Presentation Transcript Presentation Transcript

Defining An Array : Defining An Array As we know that an array is the collection finite number of data items of similar type which are stored in the memory under a single variable Name. Hence before we store the data we need to reserve spaces for the data items in the memory .Which means we need to specify the size (number of elements) of the array and also the type of the data i.e. integer type, float type, double or character type etc. Name of the array of course, need to be mentioned. Few examples are shown below : i) int number[50] this definition shows that an array Named “number” can store maximum 50 integer type data ii) Char alpha[26] this definition shows that an array Named “alpha” can store maximum 26 character type data Iii) double marks[100] this definition shows that an array Named “marks can store maximum 100 double type data note: size of the array has to be a finite integer we cannot use variaible to represent the size. Once we specify the size of the array say ‘n’ we need not store all the n elements at the same time. We may store only ‘m’ elements ( m

5 Members Recommend this Teacher
Copyrights © 2009 authorGEN. All rights reserved.