Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lsuc.UUCP Path: utzoo!lsuc!msb From: msb@lsuc.UUCP (Mark Brader) Newsgroups: net.lang.c Subject: Re: multidimensional arrays Message-ID: <303@lsuc.UUCP> Date: Fri, 18-Jan-85 18:46:13 EST Article-I.D.: lsuc.303 Posted: Fri Jan 18 18:46:13 1985 Date-Received: Fri, 18-Jan-85 20:58:10 EST References: <7227@brl-tgr.ARPA> Reply-To: msb@lsuc.UUCP (Mark Brader) Organization: Law Society of Upper Canada, Toronto Lines: 17 Summary: Um, you really can say &*expression > int a[ROWS][COLS]; > #define A(x,y) *(a + x*j + y) > func(a,i,j) > int a[1]; > .... > printf("%d\t",A(p,q)); > ... the only problem is > that the address of an array element cannot be taken. to do that you need: > > #define A(x,y) a[x*j + y] > > hey, why didn't i just say that in the first place? Really now, you might have tried it. (Yes, I did.) Of course the two are equivalent. By the way, wouldn't it be clearer to declare int a[]; without 1? Mark Brader