[LC++]Size of structure pointer/array
Paul Carter
carterp at acm.org
Fri Aug 31 09:08:14 UTC 2001
On Wed, Aug 29, 2001 at 08:48:37PM -0500, Paul Carter wrote:
> All arrays are passed as pointers. "is" by itself evaluates to a pointer
> to the first element of the array. So when the function is called, the
> address of the first element is assigned to the "i" parameter.
>
> sizeof(is) = 9*3 = 27, since "is" is an array
Oops, my math is wrong here, it would be 9*4 = 36 of course
> however the sizeof(i) = 4, since it is just a pointer
>
> (assuming int is 32-bits)
>
> --
> Paul Carter [carterp at acm.org] [http://www.drpaulcarter.com/]
--
Paul Carter [carterp at acm.org] [http://www.drpaulcarter.com/]
More information about the tuxCPProgramming
mailing list