Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!netcom!avery From: avery@netcom.UUCP (Avery Colter) Newsgroups: comp.lang.c Subject: Re: How do you declare a pointer to a two dimensional array? Message-ID: <16580@netcom.UUCP> Date: 10 Nov 90 22:13:01 GMT References: <9197@aggie.ucdavis.edu> Organization: Netcom- The Bay Area's Public Access Unix System {408 241-9760 guest} Lines: 24 Well, any array, when referred to by name only without subscripts, translates into a pointer to the lowest element of the array, i.e. the location of spam[0][0]. However, at least on my machine, pointers don't take kindly to more than one dimension of indexing. So I resorted to making a separate array of pointers, and setting each of the elements of this array of pointers to match the addresses of each of the subarrays of the original. Kinda like: int spam [10][10]; int *pointer[10]; int index; for (index=0;index<10;++index) pointer[index]=spam[index]; -- Avery Ray Colter {apple|claris}!netcom!avery {decwrl|mips|sgi}!btr!elfcat (415) 839-4567 "Fat and steel: two mortal enemies locked in deadly combat." - "The Bending of the Bars", A. R. Colter