Restored from previous forum. Originally posted by fweil.
Hi,
I am having a guess about the best way to make two variables, even of different types, having the same start address.
Some years ago I was designing Fortan apps using Equivalence keyword which allow to make ie the following :
Dim text[1000] as string * 1 (means a 1000 single characters text array)
Dim array[1000] as byte (means a 1000 single bytes array)
Equivalence text, array
From there you can either look at text or array at the same address.
How would one here do the same to make a fixed start address for both variables in good regular PureBasic coding ?
KRgds
Francois Weil
14, rue Douer
F64100 Bayonne
Equivalence in variables addresses
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
Pointers are here for that
For example:
Fred - AlphaSND
Pointers are here for that
For example:
Code: Select all
Structure Byte
b.b
EndStructure
Text$ = "HELLO"
*Cursor1.Byte = @Text$
*Cursor2.Byte = @Text$
Repeat
Debug Chr(*Cursor1\b) : *Cursor1+1
Debug Chr(*Cursor2\b) : *Cursor2+1
Until *Cursor1\b = 0
Fred - AlphaSND
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm