- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know LOC Function can return a memory address of a value. Reversely, how do I get the value from the address?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BY using a pointer. If you look at the Help for LOC (or %loc) intrinsic functions, you will
find the following
You can give values to pointers by doing the following:
- Retrieve addresses by using the LOC intrinsic function (or the %LOC built-in function)
Allocate storage for an object by using the MALLOC intrinsic function (or by using malloc(3f) on Tru64 UNIX or Linux systems, or LIB$GET_VM on OpenVMS systems)
For exampleUsing %LOC: Using MALLOC: INTEGER I(10) INTEGER I(10) INTEGER I1(10) /10*10/ POINTER (P,I) POINTER (P,I) P = MALLOC(40) P = %LOC(I1) I(2) = I(2) + 1 I(2) = I(2) + 1 The value in a pointer is used as the pointee's base address
Message Edited by anthonyrichards on 07-08-2005 03:11 AM

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page