When I do cout << &foo[0], I get "Hello". Why is that?

On 9/22/06, Steve <[EMAIL PROTECTED]> wrote:

In that case &foo would be &foo[0] it's implied

On 9/22/06, Russel Caldwell <[EMAIL PROTECTED]> wrote:
> Here's what's confusing me. If I create a integer array I will get the
> following:
>     int foo[10] = {1, 2, 3};
>
>     cout << &foo;      //gives me the address foo
>     cout << foo;        //gives me the address of of foo[0]
>
> If I create a character array:
>    char foo[] = "Hello";
>
>     cout << &foo;      //gives me the address of foo
>     cout << foo;        //gives me the string stored in foo
>     What will give me the address of foo[0]?
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
>

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/


/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to