home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
- From: torek@horse.ee.lbl.gov (Chris Torek)
- Newsgroups: comp.lang.c
- Subject: passing 2-dimensional arrays (was Someone help me with this)
- Date: 8 Nov 1992 09:41:58 GMT
- Organization: Lawrence Berkeley Laboratory, Berkeley
- Lines: 34
- Message-ID: <27295@dog.ee.lbl.gov>
- References: <1992Nov6.210507.2887@vela.acs.oakland.edu> <1992Nov6.235237.25636@sbcs.sunysb.edu>
- Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
- NNTP-Posting-Host: 128.3.112.15
-
- (Note: Please use descriptive subject lines. `Help me with this' is
- generally not very descriptive.)
-
- In article <1992Nov6.235237.25636@sbcs.sunysb.edu>
- rhorn@csws17.ic.sunysb.edu (Robert Horn) points out that declarations
- of the form
-
- t1 f(t2 v[][])
-
- (where t1 and t2 are types, f is a function name, and v is a variable
- name) are illegal in C. Further correct information can be found in
- the comp.lang.c FAQ.
-
- >... your example: char timetab[33][31] specifies an array from 0
- > to 30 of arrays 0 to 32 of characters.
-
- This is backwards: the definition[%]
-
- char timetab[33][31];
-
- declares timetab as an object of type `array 33 of array 31 of char'.
- Each of the first `array's (each timetab[i] such that 0 <= i < 33) is
- itself an <object, array 31 of char> and thus for each one, you can
- write timetab[i][j], where j >= 0 and j < 31.
- -----
- % I say `definition' here to avoid the issue of formal parameter
- declarations (which are not definitions, and which act funny when
- told that a formal parameter has an array type).
- -----
-
- Again, see the FAQ for more detail.
- --
- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
- Berkeley, CA Domain: torek@ee.lbl.gov
-