Pointers to pointers possible? 
Author Message
 Pointers to pointers possible?

Hi,

I have been trying to get this to work for the last few days, but i
just can't seem to figure it it.

I have a pointer to something. I call a procedure and inside the
procedure i want to change what the pointer points to.

a       LONG(1)
b       LONG(2)
c       &LONG

c &= a                      ! c points to a
SwapPointers(b, c)      ! we want c to point to b

Unfortunately after the procedure is called c is still pointing to a
and not to b. Inside the procedure c is pointing to b. So how do i get
to the address of c itself? In C you would solve this with a double
pointer **. But i can't get it to work in Clarion.

Btw this is just a meaningless example to demonstrate what i want to
do. In my program i am working with several linked lists and i want to
be able to call a procedure with a pointer and the procedure should
move that pointer.

Thanks,

Adriaan van Ieperen

=============================================
Remove geenSPAM from address to reply
=============================================



Sat, 04 Dec 2004 17:44:36 GMT  
 Pointers to pointers possible?
On Tue, 18 Jun 2002 09:44:36 GMT, A. van Ieperen

Quote:

>I have been trying to get this to work for the last few days, but i
>just can't seem to figure it it.

>I have a pointer to something. I call a procedure and inside the
>procedure i want to change what the pointer points to.

>a   LONG(1)
>b   LONG(2)
>c   &LONG

>c &= a                  ! c points to a
>SwapPointers(b, c)  ! we want c to point to b

>Unfortunately after the procedure is called c is still pointing to a
>and not to b. Inside the procedure c is pointing to b. So how do i get
>to the address of c itself? In C you would solve this with a double
>pointer **. But i can't get it to work in Clarion.

Scope issue?  Have you defined SwapPointers as

SwapPointers(*LONG, *LONG)

Otherwise you are just passing by value, not by address.

To get the address of c you would use ADDRESS(c), which would return
the memory address c occupies.

Jason



Sat, 04 Dec 2004 23:13:13 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ISO C Binding: Pointer to a pointer of pointers: ***argv

2. A pointer to an array of pointers

3. Pointer to pointer with LabVIEW 4.1?

4. pointers and pointers.

5. Returning Pointer To Pointer From Function

6. Implementing pointers to pointers in Ada

7. pointer to pointer to field / dynamic field

8. A couple of simple pointer questions (targets, arrays of pointers)

9. Deallocation of a pointer which points to a type containing allocated pointers

10. fortran 90/95 pointers vs C pointers

11. pointers to pointers

12. Pointer to pointer to BSTR?

 

 
Powered by phpBB® Forum Software