Thursday, March 12, 2009

what is an array?

An array is a group of variables of same data type. These variables are grouped together under a common name. Each individual variable is called as an array element and it is numbered as 0,1,2,3 and so on. These numbers are called the subscripts. An array element is referred to by the common name and its subscript enclosed in square brackets[].

For example, if the num is an integer array of size 5, these numbers would be referred as num[0], num[1],... num[4] where the number 0,1,2,3,4 are called the subscripts.

Important Rules In Array

  • The Subscripts of an array always begins with 0.
  • It is an integer.
  • It cannot be a negative number.
  • The subscripts should be enclosed with [].

No comments:

Post a Comment