Announcement

Collapse
No announcement yet.

Pointers to arrays with dual indexes

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

  • Pointers to arrays with dual indexes

    Just fixed a bug in my code. The PB/DLL 6.0 manual (didn't
    check the help file) contains an error in the sample code on
    pages 53 & 54.

    The description correctly states that 'limit' in the "OF limit"
    clause is zero based, but the sample codes shows as if it was
    BASE 1.

    Code:
    #COMPILE EXE
    
    FUNCTION PBMAIN AS LONG
       
       LOCAL ptrGraph AS LONG PTR
       LOCAL x&, y&
       
       x&=8
       y&=3
       
       DIM Graph&( x&, y&)
    
    '   INCR x&  'Per PB manual
    '   INCR y&  'Per PB manual
       
       ptrGraph = VARPTR( Graph&( 0,0) )
       
       @ptrGraph[ 3 OF x&, 2 OF y&] = 4
       
       MSGBOX "Graph(3,2)="+STR$( Graph&(3,2))
       
    END FUNCTION

    ------------------
    Bernard Ertl
    Bernard Ertl
    InterPlan Systems

  • #2
    Hmmm.. well spotted. Thanks!


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

    Comment

    Working...
    X