Global Array of a structure

Just starting out? Need help? Post your questions and find answers here.
HarryT
New User
New User
Posts: 9
Joined: Fri Jul 05, 2013 9:56 pm
Location: Southern Germany

Global Array of a structure

Post 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.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Global Array of a structure

Post 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
"Have you tried turning it off and on again ?"
HarryT
New User
New User
Posts: 9
Joined: Fri Jul 05, 2013 9:56 pm
Location: Southern Germany

Re: Global Array of a structure

Post 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
Post Reply