From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cdc097a86b9c8e55 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-04 07:45:58 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!Starbase.NeoSoft.COM!not-for-mail From: dweller@Starbase.NeoSoft.COM (David Weller) Newsgroups: comp.lang.ada Subject: Re: passing an array Date: 4 Dec 1994 09:33:52 -0600 Organization: NeoSoft Internet Services +1 713 684 5969 Message-ID: <3bsnh0$euf@Starbase.NeoSoft.COM> References: <3bqss8$2v2@news.bu.edu> NNTP-Posting-Host: starbase.neosoft.com Date: 1994-12-04T09:33:52-06:00 List-Id: In article <3bqss8$2v2@news.bu.edu>, Bill Heiser wrote: >Given a setup like the following in one procedure: > > type employee is > record > id: integer; > name: string(1..5); > dept: string(1..5); > salary: float; > end record; > > emprec: employee; > emp_a: array(1..50) of employee; > > >How can I pass the emp_a array to another function so that in the >called procedure I can change emp_a records by referencing them >as emp_a(n).id and so forth? > You've done a "style no-no" by creating an "anonymous array", the line: > emp_a: array(1..50) of employee; Is the culprit. All you've created is an object that is an array of 50 employees. While this is occasionally useful, you generally want to associate object declarations with a type (that way you can pass it as a parameter, as you're trying to do). What you should do is change that line into two lines: type emp_arr is array(1..50) of employee; emp_a: emp_arr; Now you could create a subprogram that tosses your 50 employees about with casual abandon :-) Enjoy! -- Proud (and vocal) member of Team Ada! (and Team OS/2) ||This is not your Ada -- Very Cool. Doesn't Suck. || father's Ada For all sorts of interesting Ada tidbits, run the command: ||________________ "finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.) |"Quitting C++ isn't so difficult, provided you show as much | | persistence stopping as you did starting." dweller |