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

Re: Strange C behaviour



Anthony Towns wrote:
> 
> 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.

When I used to use borland c, when you used & on an array, it would
complain about useless use of '&', which is correct, since it already
is the address...

I don't know about gcc, never tried it...
-- 
Martijn van Oosterhout <kleptog@cupid.suninternet.com>


Reply to: