Passing 2-D Arrays of unknown size ?

Chris Torek chris at mimsy.umd.edu
Sat Dec 23 08:35:20 AEST 1989


In article <1387 at engage.enet.dec.com> wallace at oldtmr.dec.com (Ray Wallace)
writes:
>[the] solution_func3() is what I would use with a slight modification to
>illiminate [sic] the calculation drawback you mention...
>
>solution_func3(array,rows,cols)
>char *array;
>int rows, cols;

Note that this requires the caller---which has something like a

	char arr[ROWS][COLS];

---to call func3() as

	func3(&arr[0][0], ROWS, COLS);

and not as

	func3(arr, ROWS, COLS);

since the latter has the wrong type (char (*)[COLS]).  Remember, C
does not have values, C has *typed* values.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list