
Data Structure

This illustrates a data structure, a means of storing data within a program.

You may see other such structures in the Data Structures category.
Get two integers from the user, then create a two-dimensional array where the two dimensions have the sizes given by those numbers, and which can be accessed in the most natural way possible. Write some element of that array, and then output that element. Finally destroy the array if not done by the language itself.

include ..\Utilitys.pmt
 
"Enter height: " input tonum nl
"Enter width: " input tonum nl
0 swap repeat swap repeat       /# create two dimensional array/list. All zeroes #/
-1 get 99 -1 set -1 set         /# set the last element o last dimension #/
pstack                          /# show the content of the stack #/
-1 get -1 get "Value of the last element of the last dimension: " print print drop
drop                            /# remove array/list from the stack #/
 