Help with pointers [message #91718] |
Fri, 14 August 2015 07:36  |
g.nacarts
Messages: 148 Registered: November 2013
|
Senior Member |
|
|
Hi
I return a 2D array in a Function (A DOUBLE = Array[216, 216]).
I wanted to return that array as a pointer and I did the following
A_Ptr = PTR_NEW(A, /NO_COPY)
RETURN, A_Ptr
I call this pointer on a different function like this:
Diff = total((A[ind] - B[ind])^2.)
But I got the following error:
"Unable to convert variable to type pointer."
I typed help, A, B
<PtrHeapVar9> DOUBLE = Array[216, 216]
B FLOAT = Array[216, 216]
I tried this as well Diff = total((*A[ind] - B[ind])^2.) but still doesn't work.
Can anyone please help with this?
|
|
|
|
|
|
|
Re: Help with pointers [message #91733 is a reply to message #91732] |
Mon, 17 August 2015 09:13  |
zacharyanorman
Messages: 17 Registered: July 2015
|
Junior Member |
|
|
Your best bet would be to go to the line where it says the error is coming from and see what the code is. Then you can do a HELP on the arguments for that line of code and see which one is incorrect. Maybe you are trying to use the pointer as the array, when you need to also use the asterisk (*) to properly get the pointer contents.
|
|
|