Announcement

Collapse
No announcement yet.

Pass 2-dim array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pass 2-dim array

    The following short program seems to pass a 2-dim array, V(2,3)
    alright, but I was surprised to find that I didn't have to somehow
    specify in the SUB argument list. In fact, in a Jan 25, 2000 response
    on this forum, Lance indicated the need to specify V(2) in the
    argument list, which seemed reasonable to me. But that syntax
    doesn't compile.

    Am I passing the arrays correctly? Or is it some sort of anomaly
    that It seems to work in this simple example?

    Code:
    #COMPILE EXE
    
    SUB orth(R() AS DOUBLE, V() AS DOUBLE)
       MSGBOX STR$(V(1, 2))
    END SUB
    
    FUNCTION PBMAIN()
       DIM R(3) AS DOUBLE, V(2, 3) AS DOUBLE
       V(1,2) = 12
       orth R(), V()
    END FUNCTION
    ------------------

  • #2
    Yes, you are passing them correctly.

    The arr(2) syntax is a PB/DOS parameter prototype characteristic, not for PB/Windows compilers.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X