I am reading some documents about c++ and it says:In c++ string is equals to const char *.Is this true?
Because i compile this code:
Isn't string equals to const char *?If equals why does this error occur and why does compiler give permission to change value of string s after initializition?Code:#include <iostream> #include <string> using namespace std; int main() { const char * p="ppppp"; string s="aaaaaaaa"; s+="eeeee"; s=p; p=s;//gives error:error C2440: '=' : cannot convert from 'std::string' to 'const char *' }



LinkBack URL
About LinkBacks



CornedBee