[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Strange C behaviour

On Tue, Apr 04, 2000 at 10:22:13PM +1000, Mikolaj J. Habryn wrote:
>     DL> You've a zone in memory that can be seen as "char *" but does
>     DL> not exist a variable that hold such value, so You can't do
>     DL> &...  of a thing that does not exist !
>   To put it another way, the C standard explicitly states that passing 
> an array as an argument causes it to decompose into a pointer to the
> base of the array - meaning that f(array, &array) is exactly
> equivalent to f(&array, &array).

f(array) is *exactly* the same as f(&array[0]). Last time I looked
(through K&R), I couldn't actually find anything that said &array was
really particularly meaningful. At the very least the type of &array
seems weird. I'd be interested in a cite, if you have one.


Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG encrypted mail preferred.

 ``The thing is: trying to be too generic is EVIL. It's stupid, it 
        results in slower code, and it results in more bugs.''
                                        -- Linus Torvalds

Attachment: pgpCCLlTKRqWj.pgp
Description: PGP signature

Reply to: