Friday, November 4, 2011

Array on Turbo Pascal


An array is a data structure consisting of many variables with the same data type, where each element has a value of the index variable. Each array element is able to store one type of data .


example :
A : array [1 .. 6] of integer;
Logically defining the array above is a set of boxes, where each box has an index value of an integer 1, 2, 3, ..., 6 each array element is characterized by:

A [1], A ​​[2], A ​​[3], A ​​[4], A ​​[5], A ​​[6]
to fill the array elements such as A [1]: = 4;.
6 5 4 3 2 1


Arrays are data structures are static, ie number of elements that have to be determined advance and can not be changed when the program runs. To declare an array in PASCAL we must first:
Defines the number of array elements
An example. const N : 10;
type.
A : array [1 .. N] of integer;



No comments:

Post a Comment