Structured data type Array

So far, we have been in working with simple data types of variables that were of the Integer, Real, or String data type . These were able to remember only one specific value that could be overwritten but could not be expanded by other separate values.

Now we are going to work with a structured data type of variables called Array. In the chapter dealing with data types we have learned that it is homogeneous data type (values ​​that include the same type). Arrays are most commonly used to work with tables, sequences, value lists, and so on. We have already encountered arrays with String data type, where the characters are the array itself.

Arrays can be imagined as a list of elements of any type with a fixed number of elements that creates it. Each single array element must be of the same specified data type. We can name (mark) each component of an array using an index (position or order in array), which is of the ordinal type (Integer, Char, Boolean). The index tells us how many elements the array will contain. Based on this we can determine its position and we can also select the previous and next items in array. For character strings, we use integer indexes from 1 to n (the number of elements) that we write in square brackets [lower_boundary..upper_boundary]. Both boundaries must have an exact value in the execution time of the command that uses the array. There is no situation where we enter the index interval [1..n], where n is not exactly specified before the command is run. We know different kinds of arrays. We will deal with one-dimensional arrays.

Vytvorte si webové stránky zdarma! Táto stránka bola vytvorená pomocou služby Webnode. Vytvorte si vlastný web zdarma ešte dnes! Vytvoriť stránky