Page 1 of 1

Global Array of a structure

Posted: Fri Jul 05, 2013 10:14 pm
by HarryT
I am very new to Pure Basic. I have knowledge about C, a Little C++ and VB.
I am trying to convert a VB6 Project into PureBasic.
How can I declare a global array of a structure ?
Until now, I couldn't find out.
Thank you for any advice.

Re: Global Array of a structure

Posted: Fri Jul 05, 2013 10:18 pm
by luis
Welcome to PB

Code: Select all

Structure MyStruct
  field1.i
  field2.s
EndStructure

Global Dim MyArray.MyStruct(10)

MyArray(0)\field1 = 0
MyArray(0)\field2 = "Hello"

MyArray(10)\field1 = 10
MyArray(10)\field2 = "Hello again"
Is this what you mean ?

http://www.purebasic.com/documentation/ ... tures.html

Re: Global Array of a structure

Posted: Fri Jul 05, 2013 10:26 pm
by HarryT
luis wrote:Welcome to PB

Code: Select all

Structure MyStruct
  field1.i
  field2.s
EndStructure

Global Dim MyArray.MyStruct(10)

MyArray(0)\field1 = 0
MyArray(0)\field2 = "Hello"

MyArray(10)\field1 = 10
MyArray(10)\field2 = "Hello again"
Is this what you mean ?

http://www.purebasic.com/documentation/ ... tures.html

Yes, that's it. Thank you