From: | Allan Odgaard |
Date: | 18 Aug 2000 at 07:36:17 |
Subject: | Re: Passing a ptr |
On 18-Aug-00, Jack York wrote:
>>> if ( ! *((array[i]) = (mystruct *) AllocVec (sizeof
>>> (mystruct)))
>> ^ - this seems to be wrong...
>>
>> What you do is check if the first field of the allocated chunk is
>> non-null.
> I'm not sure I understand this Allan for a couple of reasons. Are
> you saying that if I end up with an array of 10 structs that I should
> only check if array[0] was allocated?
No. What I say is you should check Array[0], Array[1], ... but what you
do check is *Array[0], *Array[1], ... -- i.e. rather than checking the
10 chunks you allocate, you check the first field of each of the 10
chunks. All you need is remove the star that I underlined above
(you'll need to press amiga-t to disable styles in YAM to read it
properly).
Regards Allan