Path: utzoo!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!samsung!sdd.hp.com!news.cs.indiana.edu!arizona.edu!arizona!tlglenn From: tlglenn@cs.arizona.edu (Ted L. Glenn) Newsgroups: comp.lang.c Subject: Re: More Pointers ... Message-ID: <1160@caslon.cs.arizona.edu> Date: 13 Mar 91 21:01:27 GMT References: <1991Mar13.161322.8214@uunet.uu.net> Organization: U of Arizona CS Dept, Tucson Lines: 33 In article <1991Mar13.161322.8214@uunet.uu.net>, karln@uunet.uu.net writes: > > Something bothers me about this example program. I works, but > I did not think the array passing and pointers would come out looking > like this. I've tried other ways of doing this, but this seems to be > the only way I can get it to work. Is there another way ??? > [ Program deleted ] > > Specificly the use of Board seems strange. Should I be using > int **Board somewhere? I did try using them at first, but things > wouldn't work right. Anybody care to make ANY sort of comment here? > > Karl Nicholas > karln!karln@uunet.uu.net > When you pass an array to a function, you're passing a pointer to the "top" of the array. In the function, you can make the array declaration without the *. So, you have (Board)[3][3] instead of (*Board)[3][3]. The program worked as is because you were consistent with the *. I mentioned that you were passing a pointer. That usually means that the function's declaration should have a *. Arrays, however, work a little differently. C's handling of arrays do not require the * in the function's declaration. I can't recall right now exactly how C implement's this..... Anyways, your program will be fine if you replace all the (*Board)'s with (Board). -- -Ted L. Glenn "Don't worry, be happy!" <--Ack! Pffffhhht! tlglenn@cs.arizona.edu G19382105@ccit.arizona.edu G19382105@ARIZRVAX.BITNET