Re: How to know the size of array
- From: "Vladimir S. Oka" <novine@xxxxxxxxxxxxxxx>
- Date: 23 Mar 2006 03:21:15 -0800
manochavishal@xxxxxxxxx wrote:
void foo(int * array)
void foo(int *array, size_t len)
{
Now the array size is in `len`.
Thanx for the quick reply.
I think i read somewhere that i can get the size by:
You could have read it in my reply as well, have you scrolled all the
way down. Do that now.
(sizeof(array) ) / (sizeof(element))
This is not the preferred syntax. See your textbook.
in this case it will be
(sizeof(array)) / (sizeof(int))
Look at my previous post, interspersed with your code.
I am not sure about this. Can we get the sizeof array to return the
size of all its elements.
Can sizeof find where the array is getting finished or it will just
give me the size of element.
Look at other replies in this thread.
Is there no way to get the size of array without passing the its
length.
Use the "sentinel" if you have a value that cannot happen otherwise. I
told you that already.
--
BR, Vladimir
.
- References:
- How to know the size of array
- From: manochavishal@xxxxxxxxx
- Re: How to know the size of array
- From: Vladimir S. Oka
- Re: How to know the size of array
- From: manochavishal@xxxxxxxxx
- How to know the size of array
- Prev by Date: Re: How to know the size of array
- Next by Date: Re: How to know the size of array
- Previous by thread: Re: How to know the size of array
- Next by thread: Re: How to know the size of array
- Index(es):
Relevant Pages
|