How to make the content of a 'char*' to 'char*'?

char chArray[] = "0123456789";
char* ptr = chArray;
char* ptr1 = "chArray";
using namespace std;
int main()
cout << ptr1<< endl;
return 0;

When I run the above code it will print 'chArray'. But I want to print '0123456789' using ptr1 or the content of ptr1 (ie., chArray).
How can I do this?
Please help... It's kind of urgent!
closed account (zb0S216C)
ptr1 is pointing to a string, and not chArray; "chArray" and chArray are two completely different things.

You could substitute ptr1 for ptr in the statement

cout << ptr1<< endl;

that is you could write

cout << ptr<< endl;

and you would get the contents of the array.

ptr points the first element of array chArray after its initialization in the statement

char* ptr = chArray;

while ptr1 points to the first element of the string literal "chArray"
Topic archived. No new replies allowed.