Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!rutgers!gatech!mcnc!ece-csc!ncrcae!hubcap!beede From: beede@hubcap.UUCP (Mike Beede) Newsgroups: comp.lang.c Subject: Re: Two dimensional arrays in C (AGAIN!!) Message-ID: <257@hubcap.UUCP> Date: Sun, 5-Jul-87 13:46:11 EDT Article-I.D.: hubcap.257 Posted: Sun Jul 5 13:46:11 1987 Date-Received: Tue, 7-Jul-87 05:14:42 EDT References: <254@hubcap.UUCP> Organization: Clemson University, Clemson, SC Lines: 19 in article <254@hubcap.UUCP>, beede@hubcap.UUCP (Mike Beede) says: > > #define matrix_el(array,i,j) (array[(i)*y+(j)]) , Well, Mark Brader strikes again, pointing out that the value of ``array'' could well be an expression, too. I have to agree, so the final version of this blasted thing is #define matrix_el(array,i,j) ((array)[(i)*y+(j)]) (array being an expression is not too unlikely, given C programmers' penchant for passing addresses like buffer+offset . If you're doing your own matrix sizing, you might be allocating said matrices out of a big double array . . . -- Mike Beede UUCP: . . . !gatech!hubcap!beede Computer Science Dept. ARPA: BEEDE@TECNET-CLEMSON.ARPA Clemson University INET: beede@hubcap.clemson.edu Clemson SC 29631-1906 PH: (803)656-{2845,3444}