Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!arizona!tlglenn From: tlglenn@cs.arizona.edu (Ted L. Glenn) Newsgroups: comp.lang.c Subject: Re: Getting arrays and structs into and out of functions,... Message-ID: <1424@caslon.cs.arizona.edu> Date: 17 Apr 91 22:55:07 GMT References: <1991Apr17.212135.5922@milton.u.washington.edu> Organization: U of Arizona CS Dept, Tucson Lines: 22 In article <1991Apr17.212135.5922@milton.u.washington.edu>, Rick Burgess writes > I think I need to clarify my question. I am, as yet, a novice so please > realize I need the simple and the complex answers. I wish to get structs > and arrays into and out of my functions in ways which are appropriately > clear, regular/normal/standard, efficient, and hopefully even orthoganal. C will pass the address of the first element of the array to the function, which will be expecting an address. So, in general you can: call_f(array[10]) <-- I wonder if the 10 is really required here... but it works for me on Turbo C. void call_f(array[]) <--Notice no 10. The function is only expecting the address of the beginning of the array. You can still do array[0]++ or something, but be careful not to reference the array outside of it's initially declared bounds (remember, an array of 10 goes from 0 to 9!). -- -Ted L. Glenn "Don't worry, be happy!" <--Ack! Pffffhhht! tlglenn@cs.arizona.edu tlglenn@hacks.arizona.edu G19382105@ccit.arizona.edu G19382105@ARIZRVAX.BITNET