pointers and IF statement [message #46339] |
Wed, 16 November 2005 12:08 |
JJMeyers2
Messages: 12 Registered: October 2005
|
Junior Member |
|
|
Hello,
I am trying to learn pointers and I had a problem while writing a
program.
My program is comparing two lists of data (list1,list2) and is trying
to find in which positions the data match, but because that might be in
more than 2 positions I am using the pointers to store the data. In the
case that the program does not find a match I want to be able to
substitute with another value.
So my program goes like this:
match1=ptarr(number,/allocate_heap)
FOR i=0,number-1 DO BEGIN
*match1[i]=WHERE(list1 GT list2(i))
IF *match1[i] EQ -1 THEN BEGIN
*match1[i]=WHERE(list1-list2(i) EQ min(list1-list2(i))
ENDIF
ENFOR
When i try to run this i get:
Expression must be a scalar or 1 element array in this context: <BYTE
Array[2]>.
and I can not figure out how to correct the problem.
Does anyone have any suggestions?
Thank you for the help!
|
|
|