TIP: Click on subject to list as thread! ANSI
echo: cis.tandy.coco
to: Mark Griffith 76070,41 (X)
from: Bruce MacKenzie 71725,376
date: 1990-04-30 23:42:34
subject: #3194-C arrays

#: 3206 S10/Tandy CoCo
    30-Apr-90  23:42:34
Sb: #3194-C arrays
Fm: Bruce MacKenzie 71725,376
To: Mark Griffith 76070,41 (X)

But Mark, the use of a declaration such as:

 func(array)
 int array[][6];

is standard.  I don't have K&R, but it's clearly stated in Gehani's "C: Food
For The Educated Palate" (Gehani's with Bell Labs and states in the preface
that he follows the C Programming Language Reference Manual).  It is understood
that what is passed is a pointer to the array and that the array is not copied
as are normal variables.  The brackets and the second dimension tell the
compiler the pointer points to a 2D array and is partioned in six column rows. 
The COCO compiler accepts this declaration but due to a bug uses the wrong
dimension to partion the array, ie the first rather than the second.
 By the by, I checked out your more complex declaration ie:

  int (*array)[6];

and it compiles just fine on the COCO compiler.  You are to be thanked for
pointing out what I think is the best way to program around the bug.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.