comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Accessing 2D array from pointer array within structure
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Accessing 2D array from pointer array within structure [message #31753 is a reply to message #31733] Thu, 15 August 2002 09:25 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brandon Jones (bjones8@yahoo.com) writes:

> I have a structure called "info" with an item called "img" which is a
> pointer array. Each of these pointers point to an image (2D array).
>
> IMG POINTER Array[5]
>
> I want to be able to access the image via subscripts. Is it possible?
> What is the syntax?
>
> So something like
> value=*info.img[3][130,453]
>
> I know this is invalid....but something along those lines. Right now
> my code does this, which is sloppy:
>
> tmp=*info.img[3]
> value=tmp[130,453]
>
> I can't really find any info about doing this in the docs....

The correct syntax is:

value=(*(info.img[3]))[130,453]

The problem you have here is that pointer de-referencing
has the very lowest order of precedence, lower than
array subscripting. The parentheses have the highest order
of precedence, so we throw them around pretty liberally
when we want to get things like this to work. :-)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Viewing irregular mesh in object graphics?
Next Topic: CoolHelp update

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Dec 05 08:55:34 PST 2025

Total time taken to generate the page: 0.01284 seconds