FidoNet Echomail Archive
c_echo

<<< Previous Index Next >>>

From: Len Philpot
To: All
Date: 2004-12-19 14:47:46
Subject: Re: [C] re: My brain has gone south

From: "Len Philpot" <len{at}philpot.org>

> You can't get the size of an array after you pass it to a function
> because you can't pass an array to a function directly.  It is
> converted to a pointer, which explains the sizes you're getting.  If
> you really wish to do this, wrap the array in a structure and pass
> that, then you can get the size by doing:

I'll take it as a small personal victory that I actually thought of that at
some point. Maybe there's hope for me yet! :-)


> 2.  Declare the size with a #define constant with global scope 3.
> Pass the size as an arg to the function

In this case, #2 would work just fine, since I'm passing MAX_PATH + 1 and I
can't imagine why I'd want less room, but making it was more flexible was
starting to pique my interest and I ended up doing #3.

Thanks.

--
 Len Philpot                          ><>
 len{at}philpot.org       http://philpot.org/

--- BBBS/LiI v4.01 Flag-5
 * Origin: Prism's_Point (1:261/38.1)
SEEN-BY: 633/267 270
@PATH: 261/38 123/500 106/2000 633/267


<<< Previous Index Next >>>