hi all,

i have a question about following code:

-- from here --

int i;

void
sub(int a[3])
{
        i = sizeof(a);
}

int
main(void)
{
        int a[3];
        i = sizeof(a);
        sub(a);
        return 0;
}

-- till here --

in the function sub i is 4,
and in main, it's 12.

is it because C passes the value of a to the
function sub?
even though function sub is sub(int a[3])?
                                    ^^^
is there any way to get size of a[] in sub function?

i have a book called "the c programming language"
by b. w. kernighan & d. m. ritchie, so only a 
pointer for that book will be appreciated.

regards,
--
yashi

Reply via email to