Re: Newbie-Question: Function-Parameters
From: dandelion (someone_at_meadow.net)
Date: 10/07/04
- Next message: Pedro Graca: "Re: Newbie-Question: Function-Parameters"
- Previous message: dandelion: "Re: Some advice about references on memory management in C"
- In reply to: merman: "Newbie-Question: Function-Parameters"
- Next in thread: Zian Smith: "Re: Newbie-Question: Function-Parameters"
- Reply: Zian Smith: "Re: Newbie-Question: Function-Parameters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 7 Oct 2004 17:00:15 +0200
"merman" <merman@snafu.de> wrote in message
news:416556a4$0$168$9b622d9e@news.freenet.de...
> Hi,
>
> What is the most common way to pass an array into a function - and how
> can I return it?
By pointer, which is even simpler than you may think. you could call
void foobar(int bla[])
{
}
or
void foobar( int* bla)
{
}
using
int barfoo[3] = { 1, 2, 3 };
foobar(barfoo);
The two forms of function foobar are (more or less) equivalent. the sole
identifier 'barfoo' (as opposed to barfoo[2]) evaluates to a pointer to the
array.
See? Easy.
- Next message: Pedro Graca: "Re: Newbie-Question: Function-Parameters"
- Previous message: dandelion: "Re: Some advice about references on memory management in C"
- In reply to: merman: "Newbie-Question: Function-Parameters"
- Next in thread: Zian Smith: "Re: Newbie-Question: Function-Parameters"
- Reply: Zian Smith: "Re: Newbie-Question: Function-Parameters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|