Pointers problem

Hi everyone!
I am a little confused while comparing char pointers to integer pointers.
Here is the problem:
consider the following statement;
char *ptr = "Hello";
char cArr[] = "Hello";
when I do cout << ptr; it prints Hello, same is the case with the statement
cout << cArr;
as ptr and cArr are pointers, they should print addresses rather than contents, but if I have an interger array i.e.
int iArr[] = {1, 2, 3};
if I cout << iArr; it displays the expected result(i.e. prints address) but pointers to character array while outputting doesn't show the address but shows the contents, Why??
Please address the issue.
Thanks in advance

Regards,
Ali
Your question was already answered.
http://www.cplusplus.com/forum/general/102675/
as ptr and cArr are pointers, they should print addresses rather than contents
ptr is a pointer. cArr is an array. They aren't the same.

The C Programming Language does not have a string type. But there is a convention to implement strings as a null terminated sequence of chars. This is supported by the language as it allows you to specify "Hello" and it understands that's a char[6]. And it's supported by the C runtime library with a set of string manipulation functions, and also I/O. So, the C++ I/O stream library will treat a char* or a char array as a C string.

There's no such precedent for arrays of ints or anything else. char* is a special case.
@kbw : ptr is pointer and cArr is pointer to the first element of the array, because of this fact I said that ptr and cArr are same.
Topic archived. No new replies allowed.