i am comparing string pointer with other pointer but string pointer gives error while writing this code
i tried printing element using string pointer but actually gets error
int main()
{
string s="abcde";
string *sh=&s;
cout<<sh[2]<<" "<<s[2]<<endl;
}
RESULT -ERROR
#includeany headers, sostringandcoutare undefined. I can guess thatstringisstd::string, but it's not clear. Also, you didn't show us the error message. I'll add a "c++" (always include a tag specifying the language you're using). Finally, "CPP" refers to the C Preprocessor; the language is "C++".