2ch8 - Procedures Functions Arrays & File Handling
2ch8 - Procedures Functions Arrays & File Handling
Parameters:
Parameters are the variables that store the values of
the arguments passed to a procedure or function.
Some but not all procedures and functions will have
parameters.
When procedures and functions are defined, the
first statement in the definition is a header, which
contains:
In this code we have used the variable Counter as the array index.
Two-dimensional arrays
A two-dimensional array can be referred to as a table, with
rows and columns.
Example of a table with 10 rows and 3 columns, which
contains 30 elements. The first element is located at
position 0,0.
When a two-dimensional array is declared in pseudocode:
» the first index value for rows
» the last index value for rows
» the first index value for columns
» the last index value for columns
» and the data type are included.
For example:
The declared array can then be populated using a loop, just
like for one dimensional arrays – however this time there
need to be two nested loops, one for each index:
We can display the data that lies in a particular location in a
two-dimensional array as follows:
Example: