[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Return pointer to array: not possible?
From: |
Axel von Kamp |
Subject: |
Re: Return pointer to array: not possible? |
Date: |
Thu, 01 Apr 1999 18:12:47 +0100 |
Paul E. Johnson wrote:
> I'm just fiddling around, really, learning ways to torture C and
> Objective-C. But I figured some of you with actual computer training
> might save me a bit of trouble.
>
> Suppose you have a C array of objects, declared like so
>
> id attribute[10];
>
> How can I return that when another agent wants the attribute vector?
return attribute;
It's as simple as that. Your method definition then would look like:
-(id *)getAttributeArray
{
return attribute;
}
> I figure there has to be a better way, such creating a pointer to the
> array, and returning that. But I can't get it to work, can't find a
> clear example in any of the C books I have.
The name of a C vector is synonym to the address of its first element. Thus
it can be used as pointer to that vector.
Strange that none of your C books mentions this...
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Return pointer to array: not possible?, Paul E. Johnson, 1999/04/01
- Re: Return pointer to array: not possible?, Eric Werk, 1999/04/01
- Re: Return pointer to array: not possible?,
Axel von Kamp <=
- Re: Return pointer to array: not possible?, Marcus G. Daniels, 1999/04/01
- optimization and C arrays (was Re: Return pointer to array: not possible?), Theodore C. Belding, 1999/04/01
- Re: Re: Return pointer to array: not possible, Eric Werk, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: not possible?), Marcus G. Daniels, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: notpossible?), Paul E. Johnson, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: notpossible?), Marcus G. Daniels, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: notpossible?), Theodore C. Belding, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: notpossible?), Sven N. Thommesen, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: notpossible?), Marcus G. Daniels, 1999/04/01
- Re: optimization and C arrays (was Re: Return pointer to array: notpossible?), Sven N. Thommesen, 1999/04/01