09.10.2014 Views

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Element[1] = 101<br />

Element[2] = 102<br />

Element[3] = 103<br />

Element[4] = 104<br />

Element[5] = 105<br />

Element[6] = 106<br />

Element[7] = 107<br />

Element[8] = 108<br />

Element[9] = 109<br />

Element[10] = 110<br />

Pascal Arrays in Detail<br />

Arrays are important to Pascal and should need lots of more details. There are following<br />

few important concepts related to array which should be clear to a Pascal programmer:<br />

Concept<br />

Multi-dimensional arrays<br />

Dynamic array<br />

Packed array<br />

Passing arrays to<br />

subprograms<br />

Description<br />

Pascal supports multidimensional arrays. The simplest form of<br />

the multidimensional array is the two-dimensional array.<br />

In this type of arrays, the initial length is zero. The actual<br />

length of the array must be set with the standard SetLength<br />

function.<br />

These arrays are bit-packed, i.e., each character or truth<br />

values are stored in consecutive bytes instead of using one<br />

storage unit, usually a word (4 bytes or more).<br />

You can pass to a subprogram a pointer to an array by<br />

specifying the array's name without an index.<br />

Multidimensional arrays<br />

Pascal programming language allows multidimensional arrays. Here is the general form of<br />

a multidimensional array declaration:<br />

type<br />

array-identifier = array [index-type1, index-type2, ...] of element-type;<br />

var<br />

a1, a2, ... : array-identifier;<br />

For example, the following declaration creates a three dimensional 5 . 10 . 4 integer<br />

array:<br />

var<br />

threedim: array[1..5, 1..10, 1..4] of integer;<br />

TUTORIALS POINT<br />

Simply Easy Learning Page 84

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!