Board index » delphi » M353 Programming and Programming Languages

M353 Programming and Programming Languages

On 24 Jan 1997 19:58:32 GMT, "Mr.N.Lewis" <roc...@globalnet.co.uk>
wrote:

Quote
>    The course is based in its early parts around Pascal , there in lies my
>difficulty , I have studied P ascal about three years ago and the brain is
>a bit rusty, how do I declare a two dimensional array indexed with two
>different types ?

something like:

twodimensionalarray: array[1..10, 1..5] of integer;
or
twodimensionalarray: array[1..5, 'a'..'z'] of integer;

That is about the extent of it...

Glenn Grotzinger
Web Page: http://www.geocities.com/Paris/3537
Writer of the Excellent Training Manual known as the TP Tutorial.
To email, if you hit the reply button, delete the {remove_this}
out of the replied message.  Just some protection from SPAM. :(

 

Re:M353 Programming and Programming Languages


Is there anybody who can offer any assistance with this Open University
course?

        The course is based in its early parts around Pascal , there in lies my
difficulty , I have studied P ascal about three years ago and the brain is
a bit rusty, how do I declare a two dimensional array indexed with two
different types ?

Re:M353 Programming and Programming Languages


In article <32e7a026.934...@news.internetland.net> of Thu, 23 Jan 1997
17:32:20 in comp.lang.pascal.misc, Programmer Dude

Quote
<ggr...@internetland.net> wrote:
>On 24 Jan 1997 19:58:32 GMT, "Mr.N.Lewis" <roc...@globalnet.co.uk>
>wrote:

It seems that one of you is a day in error.

Quote
>>      The course is based in its early parts around Pascal , there in lies my
>>difficulty , I have studied P ascal about three years ago and the brain is
>>a bit rusty, how do I declare a two dimensional array indexed with two
>>different types ?

>something like:

>twodimensionalarray: array[1..10, 1..5] of integer;
>or
>twodimensionalarray: array[1..5, 'a'..'z'] of integer;

>That is about the extent of it...

One should point out that the types may be defined before the array is
declared; for example

        type Fred = '&'..'*' ;
        var TwoDArr : array [Fred, byte] of char ;
and that the above line is short for
        var TwoDArr : array [Fred] of array [byte] of char ;

Generally, if one has more than one instance of x..y with the same x, y
in a program, and the x, y do not vary independently, one should define
these as a named type (or set).

--
John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk  Turnpike v1.12  MIME
    http://www.merlyn.demon.co.uk/
    My news-service has had variable delivery backlog, 0-60 hours.
    Standard signature separator is as above, a line containing "-- "

Other Threads