Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pointer in Basic
#17
Code: (Select All)
DIM a AS _BYTE
DIM b AS INTEGER
DIM c AS LONG
DIM d as _INTEGER64
DIM e as _FLOAT
DIM ends as _byte ' <-- should serve as the end

PRINT HEX$(_OFFSET(a))
PRINT HEX$(_OFFSET(b))
PRINT HEX$(_OFFSET(c))
PRINT HEX$(_OFFSET(d))
PRINT HEX$(_OFFSET(e))
PRINT HEX$(_OFFSET(ends))

The output shows you the memory addresses that are reserved for the variables.
Since they all follow each other in memory, you can view the addresses in a memory viewer.

QB64 actually reserves 8 bytes for each variable. Except for _FLOAT 32 bytes are reserved.

The wiki says nothing about how variables are reserved in memory.
It only says how many bytes are used.

Example:
A INTEGER used 2 bytes.
QB64 reserved 8 bytes for it in the memory.

The first 2 bytes of this reserved bytes are used. The rest remains unused.
This can be observed even via a memory viewer.

[Image: memn1fim.png]
Reply


Messages In This Thread
Pointer in Basic - by Kernelpanic - 07-16-2023, 09:57 PM
RE: Pointer in Basic - by bplus - 07-16-2023, 10:17 PM
RE: Pointer in Basic - by mnrvovrfc - 07-17-2023, 12:05 AM
RE: Pointer in Basic - by SagaraS - 07-17-2023, 12:17 AM
RE: Pointer in Basic - by OldMoses - 07-17-2023, 12:40 AM
RE: Pointer in Basic - by bplus - 07-17-2023, 01:00 AM
RE: Pointer in Basic - by a740g - 07-17-2023, 02:53 AM
RE: Pointer in Basic - by SpriggsySpriggs - 07-17-2023, 11:55 AM
RE: Pointer in Basic - by Kernelpanic - 07-17-2023, 07:04 PM
RE: Pointer in Basic - by SagaraS - 07-17-2023, 09:39 PM
RE: Pointer in Basic - by mnrvovrfc - 07-17-2023, 10:52 PM
RE: Pointer in Basic - by Kernelpanic - 07-18-2023, 12:17 AM
RE: Pointer in Basic - by SagaraS - 07-18-2023, 02:42 AM
RE: Pointer in Basic - by bplus - 07-18-2023, 12:39 PM
RE: Pointer in Basic - by SMcNeill - 07-18-2023, 04:13 PM
RE: Pointer in Basic - by Kernelpanic - 07-18-2023, 04:26 PM
RE: Pointer in Basic - by SMcNeill - 07-18-2023, 04:59 PM
RE: Pointer in Basic - by SagaraS - 07-18-2023, 04:49 PM
RE: Pointer in Basic - by SMcNeill - 07-18-2023, 05:04 PM
RE: Pointer in Basic - by mnrvovrfc - 07-18-2023, 08:15 PM
RE: Pointer in Basic - by SagaraS - 07-18-2023, 07:30 PM
RE: Pointer in Basic - by SMcNeill - 07-18-2023, 10:11 PM
RE: Pointer in Basic - by SagaraS - 07-19-2023, 10:27 AM
RE: Pointer in Basic - by SMcNeill - 07-19-2023, 01:42 PM
RE: Pointer in Basic - by DSMan195276 - 07-19-2023, 11:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BASIC is 60 years old bert22306 12 2,309 07-29-2024, 05:19 PM
Last Post: bobalooie
  When BASIC was at the top, do you agree? TempodiBasic 25 4,487 07-11-2024, 10:31 PM
Last Post: Pete
  a Tiny Basic Forum solo88 2 675 05-31-2024, 04:46 PM
Last Post: bplus
  Another Phoenix Basic with bird logo out there. Dav 9 1,852 05-18-2024, 07:19 PM
Last Post: Kernelpanic
  BASIC turns 60 today! TerryRitchie 10 1,876 05-02-2024, 05:36 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)