In case 1 the output is blank when I initialize a string like this:
#include <iostream>
#include<string>
using namespace std;
//CODE 1
int main()
{
string s="hello" + 'c';
cout<<s<<endl;
return 0;
}
but when I write it this way it works fine:
#include <iostream>
#include<string>
using namespace std;
//CODE 2
int main()
{
string s="hello";
char k='c';
s+=k;
cout<<s<<endl;
return 0;
}
Now I am confused as in another question asked on stack overflow it says that there is no difference between string and std::string when namespace std is used, those answers go by saying that -> There is no functionality difference between string and std::string because they're the same type std::string vs string in c++ whereas the answers provided for this question are pointing differences:
compiler is g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)