Announcement

Collapse
No announcement yet.

Multi - dimensional array pointers

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

  • Multi - dimensional array pointers

    A single dimension array pointer is stored in a series..

    offset what is stored at address
    i%(0)=1 0 1
    i%(1)=2 2 2
    i$(2)=3 4 3

    How is a mult-dimension array stored?

    i%(0,0)
    i%(0,1)
    i%(0,2)
    i%(1,0)

    etc...


    Tyrone

    -------------
    Explorations v3.0 RPG Development System
    http://www.explore-rpg.com
    Explorations v9.10 RPG Development System
    http://www.explore-rpg.com

  • #2
    Tyron --
    Hope, this is an answer on your question
    Code:
    #Compile Exe
    #Register None
    DefLng a-z
    $Include "win32Api.Inc"
    
    Function PbMain()
    
       Dim a&(1 : 3, 1 : 5)
       Dim aa As Long Ptr
       For i = 1 To 3: For j = 1 To 5
          a&(i, j) = 100 * i + j
       Next: Next
       aa = VarPtr(a&(1, 1))
       For i = 1 To 15
          w$ = w$ + Str$(@aa)
          aa = aa + 4
       Next
       MsgBox w$
    
    End Function

    Comment


    • #3
      Quote from PowerBASIC/DLL for windows help
      -User's Guide
      --Data Types
      ---Arrays -> Very bottom of the page.

      "---
      Internal representations of arrays
      PowerBASIC stores arrays in column-major order: Array(0,0) is first (lowest) in memory, then Array(1,0), then Array(2,0), and so on through all the rows of the array. After the rows are taken care of, the next column is stored.
      ---"


      -------------
      Colin Schmidt & James Duffy, Praxis Enterprises, Canada

      Comment


      • #4
        Thanks guys..



        -------------
        Explorations v3.0 RPG Development System
        http://www.explore-rpg.com
        Explorations v9.10 RPG Development System
        http://www.explore-rpg.com

        Comment

        Working...
        X