Mail Archives: djgpp/2001/01/15/12:21:31.1
Jon <lennier AT online DOT no> wrote:
> Does anyone know how I can pass an array like this: char a[20][30];
> to a function? How would the prototype for a function which would
> take this as an argument, and how should it be passed to the
> function?
If that's really all you want to do, it's very easy and straightforward:
void myfunction (char a[20][30])
{
/* do something with it */
}
int main(void)
{
char a[20][30];
myfunction(a);
return 0;
}
It's really as simple as that. It only becomes complicated if you want
to use variables in the place of the fixed '20' and '30', above. Then
you need pointers, and pointers-to-pointers, or complicated variable
declarations.
[Further discussion in a generic C newsgroup, please. This has almost
no relevance to DJGPP, in particular.]
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -