pointers

hi every body.
i have one fundamental question
in this code :
const char* a[2] = {"ab","bc"};
"a" array is a array of pointers but why we get it "ab" and "bc" instead of address?

Because in the expression :
cout << a[0] operator<<() is overloaded explicitly for char*.
if it's overloaded for char* so why when we write :
1
2
3
4
char a[3] = "ab";
char b[3] = "cd";
const char* names[4] = {a,b};
cout << names[0]; 

answer is "ab" instead of address of a[0];
Last edited on
well your are confusing yourself with array of pointers.
names is array of pointers to char.

so names[0] type is const char *,once you gives this type of datatype to any ostream or printf,it will print the data pointed by that pointer,in this case it will print ab.
Topic archived. No new replies allowed.