c++ question

Byron Clark byron at theclarkfamily.name
Fri Sep 22 18:17:16 MDT 2006


Russel Caldwell wrote:
> When I do cout << &foo[0], I get "Hello". Why is that?

Because cout always interprets a char * as a directive to print the NULL 
terminated string that the argument points to.

If you want to see the address of foo (which is also the address of the 
first element of foo) you'll want to use printf("%p", foo).



More information about the PLUG mailing list