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

Home » Public Forums » archive » Re: pointer & 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: pointer & structure [message #69276 is a reply to message #69274] Tue, 12 January 2010 07:50 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jan 12, 1:42 pm, bing999 <thibaultga...@gmail.com> wrote:
> Hi,
>
> i have created a structure S which contains a few elements (arrays)
> a,b,c : S={a,b,c}
> Then i replicate it N times.
> Now i want to create iteratively 10 other structures with the same
> skeleton.
> Since, i did not see any other way to do, i used a pointer p to stock
> the structures:
>
> for k=0,10 do begin
> *p(k) = S
> endfor
>
> By typing help,*p(k) i know *p(k) is indeed a structure BUT *p(k).a
> (for instance) prints "Expression must be a structure in this context:
> P"
>
> So my question is: how can I extract the information stored in *p(k) ?

The issue is the precedence of the operators. Use

(*p[k]).a

*p[k].a means *(p[k].a)

You do not need pointers for that array, you could have directly put
that in a structure array with p=replicate(S,N), which makes an array
with N copies of S. Then you can change the values of individual
elements by their indexes.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Greek Symbols in Plot Annotations
Next Topic: Re: isurface with custom palette

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

Current Time: Sat Oct 11 12:12:52 PDT 2025

Total time taken to generate the page: 1.81288 seconds