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 #31733 is a reply to message #31720] Thu, 15 August 2002 15:46 Go to previous messageGo to previous message
bjones8 is currently offline  bjones8
Messages: 6
Registered: August 2002
Junior Member
David--

Thanks again! It didnt occur to be that it was a operator precedence
issue...now my program is alot faster :-)

-Brandon

David Fanning <david@dfanning.com> wrote in message news:<MPG.17c583df8c8d86a5989959@news.frii.com>...
> 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
[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: Thu Oct 30 01:01:39 PDT 2025

Total time taken to generate the page: 2.56340 seconds