The following fails with the error prog.cpp:5:13: error: invalid conversion from ‘char’ to ‘const char*’
prog.cpp:5:13: error: invalid conversion from ‘char’ to ‘const char*’
int main() { char d = \'d\'; std::s
Also adding insert option, as not mentioned yet.
std::string str("Hello World"); char ch; str.push_back(ch); //ch is the character to be added OR str.append(sizeof(ch),ch); OR str.insert(str.length(),sizeof(ch),ch) //not mentioned above