Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!harvard!panda!genrad!decvax!mcnc!unccvax!innes From: innes@unccvax.UUCP (Norm Innes) Newsgroups: net.micro.amiga Subject: Re: BASIC help needed: passing arrays to SUBs Message-ID: <545@unccvax.unccvax.UUCP> Date: Tue, 29-Jul-86 10:14:44 EDT Article-I.D.: unccvax.545 Posted: Tue Jul 29 10:14:44 1986 Date-Received: Thu, 31-Jul-86 02:00:12 EDT References: <8607240110.AA05004@ucbvax.Berkeley.EDU> Organization: UNC-Charlotte Lines: 29 > Hi- > Perhaps someone can help me with a simple (I assume) problem I'm > having with AmigaBasic and can't get around no matter what I try. > > The problem is simple: I'm trying to given a array argument to a > SUBprogram. The manual sure makes it look like it is supposed to work, > but everything I try earns me a "type mismatch" on the CALL statement. > > For example: > SUB pcell (a(1), i) STATIC > print a(i) > END SUB > > DIM x(10) > x(1) = 1.5 > PRINT x(1) > CALL pcell(x, 1) > > The PRINT works find, but I get the aforementioned "type mismatch" error >on the CALL statement. What am I doing wrong?? It appears that the array parameter in the call should be followed by (), as suggested by the example on page 6-3 of the Amiga Basic manual. On page 6-4 it states that an integer should not be passed to a single presision (in this case, passing 1 to i). The call should therefore look like: n = 1 CALL pcell(x(),n)