C++ pointer doubt

How can I point to the first character of variable declared using string data type, using pointer?

String a=“abcd”;

Prints the whole string

I think you want to know about JAVA?
But in C++, you have to declare as char *a=“abcd”;

Pointers would have worked fine if you have used char datatype instead of string.

char a[] = “abc”;
cout << *a << endl;

For string, use iterators:

string a = “abc”;
cout << *a.begin() << endl;

Thank you for your reply.