C++ examples for Data Type:string
Use the pointer to access the individual parts of the string
#include <iostream> using namespace std; int main()//from w w w .j ava 2 s. co m { string s; string *ptrToString; s = "this is a test from book2s.c o m"; ptrToString = &s; for (unsigned i = 0; i < s.length(); i++){ cout << (*ptrToString)[i] << " "; } cout << endl; return 0; }