Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!lll-crg!seismo!brl-tgr!tgr!jeff@isi-vaxa.arpa From: jeff@isi-vaxa.arpa (Jeffery A. Cavallaro) Newsgroups: net.lang.c Subject: PASSING MULTIDIMENSIONAL ARRAYS Message-ID: <138@brl-tgr.ARPA> Date: Wed, 27-Nov-85 18:30:05 EST Article-I.D.: brl-tgr.138 Posted: Wed Nov 27 18:30:05 1985 Date-Received: Fri, 29-Nov-85 21:43:02 EST Sender: news@brl-tgr.ARPA Lines: 28 I have an application where I want to pass a 2D array to a subroutine. The data does not easily avail itself to being converted to a 1D array of structures. How can one access the array in the subroutine??? For example: Calling routine: struct x a[M][N]; subrout(M, N, a); C does not have "adjustable arrays" like FORTRAN. So what is one to do? The only way I can see to do it is: subrout(m, n, a) struct x *a; and do the address arithmetic yourself. I believe that this is OK, because the innermost (leftmost) index is guaranteed to increase fastest, and C compilers are required to be consistent about packing when doing address arithmetic or aggregate allocation (I think). Any hints??? Thanx, Jeff