How to resolve the algorithm Address of a variable step by step in the Panoramic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Address of a variable step by step in the Panoramic programming language
Table of Contents
Problem Statement
Demonstrate how to get the address of a variable and how to set the address of a variable.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Address of a variable step by step in the Panoramic programming language
Source code in the panoramic programming language
== Get ==
adr(variable)
Example:
dim a
print adr(a)
== Set ==
Whether Panoramic is able to set the value of a variable may depend on what is meant by that. Panoramic implements the
poke command to set a byte from a value of 0 to 255 (inclusive). Panoramic also implements the peek command to get
the value of a byte, so it is possible to the following:
(A)
dim a
rem a variable with no post-fix is a real.
poke adr(a),57
rem the value of a variable being set by setting an address, the address of a in this instance.
(B)
dim a%,b%
rem % means integer.
b%=57
poke adr(a%),b%
rem b% being assigned to the address of a%, in this instance.
rem it is even possible to free b%
free b%
print a%
(C)
dim a,b
b=57
poke adr(a),b
b=peek(adr(a))
print b
rem the address of b being, in effect, set to the address of a, the address of a, in this instance.
rem Observations and further insight welcome.
''Note:'' An attempt to poke a real or an integer (Panoramic's only numeric types) value of less than 0 or of more than
255 will cause an error.
You may also check:How to resolve the algorithm Heronian triangles step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Lah numbers step by step in the C# programming language
You may also check:How to resolve the algorithm Pascal's triangle step by step in the VBA programming language
You may also check:How to resolve the algorithm Matrix multiplication step by step in the 360 Assembly programming language
You may also check:How to resolve the algorithm Strip a set of characters from a string step by step in the Rust programming language