operator returns the address of a variable as an integer.
i is int
z is ASCIIZ string on 50
t is array of 10 reals
s is composed of
The_Age is int
The_Name is string ASCIIZ on 50
addr is int
addr = & i
addr = & z
addr = & z + 2 // Address of the 3rd character of the string
addr = & t // Address of the beginning of array (therefore of 1st element)
addr = & t // Address of the 5th element
addr = & s // Address of the structure and therefore of s.age
addr = & s.The_Age
addr = & s.The_Name
<Result> = &<Variable Name>
Address of the specified variable.
<Variable name>: Any type
Name of variable to use.
- The & operator is used to find out the address of any type of variable (simple and composite variables).
- The & operator is mainly used to pass addresses to API or CallDLL32.
- The & operator cannot be used to retrieve the address:
- of a control,
- of a HFSQL item.
The & operator displays an error then when compiling the project. Indeed, the addresses of these two elements may change at any time.
- If a "Character string" must be passed by address to API or to CallDLL32, you must not use a String variable: the address of the string may change at any time. we recommend that you use the ASCIIZ String type.
- If the variable is a local variable, the value returned by the & operator must only be used in the process where the variable was declared. When the current process is ended, the address will be invalid and it must not be used anymore.