From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Passing array to function trouble. Date: 15 Jan 2001 17:02:20 GMT Organization: Aachen University of Technology (RWTH) Lines: 34 Message-ID: <93vaes$587$1@nets3.rz.RWTH-Aachen.DE> References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 979578140 5383 137.226.32.75 (15 Jan 2001 17:02:20 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 15 Jan 2001 17:02:20 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Jon 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.