c++ question

Richard Scott McNew richard.scott.mcnew at gmail.com
Fri Sep 22 17:04:42 MDT 2006


On 9/22/06, Richard Scott McNew <richard.scott.mcnew at gmail.com> wrote:
> > It depends on what you mean by "character array".  If you are talking
> > about a variable declared like so:
> >
> > char myarray[32];
> >
> > Then to get the address, you would do the following:
> >
> > print("The address is %p\n", (&myarray));
>
> Shouldn't that be:
> print("The address is %p\n", (myarray));
>
> The variable myarray is a pointer to the beginning of the array.  That
> means that:
> *myarray and myarray[0] are the same.
>
Hmmm, it seems that both work in GCC.



More information about the PLUG mailing list