Ads

Array (Single Dimensional and Double Dimensional)

An array is a structure created in the memory to represent a number of values of the same data type with variable having the same variable name along with different subscript (location). An array is also called Subscripted Variable. An array with empty [ ] represents an unfixed number of cells in the memory.

An array is basically of two types:

1) Single Dimensional Array
2) Double Dimensional Array

Creating Single Dimensional Array (SDA)

The syntax to crate a single dimensional array is as shown below:
<Data type> <variable>[ ] = new <Data type>[size of the array];

e.g., int m[ ] = new int[10]; means m is an integer type array that can store 10 data items in the memory with different subscripts along X-axis. However, the storage of the array elements begin with the 0th subscript as shown below:


Here, m0 can be written as m[0] where m is subscripted variable and 0 is subscript.


In this illustration shown above, 0, 1, 2, ......, 9 are referred to as subscripts and they help in both input and output of the array elements. 


SHARE

Author

Hi, Its me Hafeez. A webdesigner, blogspot developer and UI/UX Designer. I am a certified Themeforest top Author and Front-End Developer. I'am business speaker, marketer, Blogger and Javascript Programmer.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 Comments:

Post a Comment