Re: string array v.s. int array
George wrote:
wchar_t me[] = L"Hello World \n";
....
int values[] = { 10, 20, 30, 40, 55, 60, 70, 80, 90, 100 };
On top of all of the other fine answers, one thing stood out at me as
something you're possibly unclear on: You do not have an array of string
and an array of int. Rather, you have an array of char and an array of int.
std::ostream "helps" you by supplying an overloaded operator << that, given
a char*, pulls a zero-terminated string from that address, while an int*
sent to an ostream will simply yield the address of the array since there's
no overloaded operator << that accepts an int*, so it matches the overload
for void*. If you were to cast the pointer to your char array to a void*,
thus disabling the overload for char*, you'd get identical treatment for the
two cases:
[Code]
#include <iostream>
#include <string>
using namespace std;
int main()
{
wchar_t me[] = L"Hello World \n";
wchar_t (*me2_ptr)[14] = &me;
wcout << (void*)*me2_ptr << endl; // output Hello World
wcout << **me2_ptr << endl; // output H
int values[] = { 10, 20, 30, 40, 55, 60, 70, 80, 90, 100 };
int (*pval)[10] = &values;
wcout << *pval << endl; // output 0x0017f6f0
wcout << **pval << endl; // output 10
return 0;
}
[/Code]
-cd