Mission Impossible:
void foo(char *p) {
int array_len = 0;
array_len = sizeof(p)/sizeof(char);
}
What's the result of array_len after executing this function?
Under 32bits system, always "4", cause: 4/1=4.
2009/4/2 Tyler Littlefield <[email protected]>
> >Doesn't work.
>
> it's worked before. :p
>
>
> Thanks,
> Tyler Littlefield
> Web: tysdomain.com
> email: [email protected] <tyler%40tysdomain.com>
> My programs don't have bugs, they're called randomly added features.
>
> ----- Original Message -----
> From: Paul Herring
> To: [email protected] <c-prog%40yahoogroups.com>
> Sent: Thursday, April 02, 2009 9:02 AM
> Subject: Re: [c-prog] How many elements in the array?
>
> On Thu, Apr 2, 2009 at 3:54 PM, Tyler Littlefield
> <[email protected]<tyler%40tysdomain.com>>
> wrote:
>
> char x[] = "hello world";
>
> int foo(char* array){
> [...]
> > sizeof(array)/sizeof(array_type)
>
> Doesn't work.
>
> --
> PJH
>
> http://shabbleland.myminicity.com/tra
> http://www.chavgangs.com/register.php?referer=9375
>
> [Non-text portions of this message have been removed]
>
>
>
[Non-text portions of this message have been removed]