Can someone explain this syntax please?

Just starting out? Need help? Post your questions and find answers here.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Can someone explain this syntax please?

Post by Kale »

I saw some wierd syntax in the Tsunami Record Manager thread: (viewtopic.php?t=4918) and wondered if someone could explain it to me please.

Code: Select all

SehName.b[25]
KeyLen.b[6]
KeyLen1.b[43]
Notice the square brackets at the end of the byte variables, what is the function of these? i couldn't seem to find anything about them in the PB Docs.

:?:
--Kale

Image
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

Those SquareBrackets are almost surely to be found in Structures, am I right?
Now, they indicate an static Array, since in Structures there mustn't be an dynamic Array. This is so, because Structures need a fixed size.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Looks like square brackets are used in static arrays..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Dim StaticArray.b(10) <--- This is the correct syntax for static arrays isn't it?

StaticArray.b[10] <--- This is different isn't it?
--Kale

Image
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

Kale wrote:Dim StaticArray.b(10) <--- This is the correct syntax for static arrays isn't it?

StaticArray.b[10] <--- This is different isn't it?
Dim StaticArray.b(10) is dynamic array, and globally accessable. It can change the size (with dim again)
StaticArray.b[10] is static array, and only usefull in structures. It can't change its size.

Anyway, both works same way.
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

ah... i see :) thanks!
--Kale

Image
newbie
Enthusiast
Enthusiast
Posts: 296
Joined: Tue Jul 29, 2003 5:47 pm
Location: FRANCE
Contact:

Post by newbie »

thanks too, i know now why such

"Global Dim Array()" didn't works :D
- Registered PB user -

Using PB 4.00
Post Reply