cosell@BBN-PROPHET.ARPA (Bernie Cosell) (07/24/86)
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??
Much thanks
  /Bernie
Bernie Cosell                       Internet:  cosell@prophet.bbn.com
Bolt, Beranek & Newman, Inc         USENET:    bbncc5!bpc
Cambridge, MA   02238               Telco:     (617) 497-3503innes@unccvax.UUCP (Norm Innes) (07/29/86)
> 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)
mitsu@well.UUCP (Mitsuharu Hadeishi) (07/30/86)
WHOAA()()()()()
     If you want to pass an array to a subprogram in AmigaBasic,
you simply use CALL Subprogram(array(),etc.) . . .
				-Mitsu (mitsu@well.UUCP)