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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,998965b11075593f,start X-Google-Attributes: gid103376,public From: greg Subject: Beginner's question (array parameters to functions) Date: 1998/11/27 Message-ID: <365F4360.F7E85C1E@columbia.edu>#1/1 X-Deja-AN: 416357143 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 912212516 26681 (None) 128.122.175.162 Organization: New York University Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-11-27T00:00:00+00:00 List-Id: I have a homework assignment which involves writing an Ada program that sorts an array of items. One requirement of the assignment is that the sorting be done by a function which takes the array as a parameter and returns a sorted array. The other details of the assignment (the particular sorting method to use, etc.) are not pertinent to my question so I do not mention them here. My question is the following: As I understand it, in an Ada function, a parameter must be passed in "in" mode. Therefore, I assume that in this assignment, the sorting function has to make a copy of the array parameter, sort the items in this second array, and finally return this second array to the caller subprogram, because, given that the array is passed as a parameter, there is no way to change the values of the array that is copied in for use in the function. (I realize that it would be possible to use a procedure instead of a function, or to use a global variable rather than pass any parameter to the sorting function, but let's assume that that would not be acceptable in this assignment.) Is my understanding correct, or is there some way to avoid having to use two arrays? g.