Dim and datasection?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Are Dim global's etc always placed at the datasection?

Or can I speed it up by doing the following

Code: Select all

DataSection
Dim test.s(100)
For i = 0 To 100
 test(i)="nr" +Str(i)
Next i
EndDataSection


OpenConsole()
For i = 0 To 100
 Print (test(i) )
 PrintN ("")
Next i

Print ("press enter key")
Input() 
CloseConsole()

End

Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by cor

Are Dim global's etc always placed at the datasection?
I don't think so. DataSection is only for embedding data into your executable. Arrays and things are allocated from memory when you dim them.


--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.51, Ed3.53)
Post Reply