Groovy hepcat kelvSYC was jivin' on Sat, 11 Oct 2003 18:58:07 GMT in
comp.lang.c.
Passing Arrays to Functions's a cool scene! Dig it!
>Suppose I had an array of some arbitrary size
>
>struct foo a[10];
>
>and I pass that into some function
>
>void bar(struct foo *b);
>
>How do I calculate the number of elements in a[] (10) from within bar()?
Change the declaration of bar() to the following, and pass the
addrerss of a to it:
void bar(struct foo (*)[10]);
int main(void)
{
struct foo a[10];
bar(&a);
return 0;
}
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?