whats the difference between C Strings and C++ strings. Specially while doing dynamic memory allocation
C++ strings are much safer,easier,and they support different string manipulation functions like append,find,copy,concatenation etc.
one interesting difference between c string and c++ string is illustrated through following example
#include
using namespace std;
int main() {
char a[6]; //c string
a[5]='y';
a[3]='o';
a[2]='b';
cout<
output »¿boRy¤£f·Pi»¿
#include
using namespace std;
int main()
{
string a; //c++ string
a.resize(6);
a[5]='y';
a[3]='o';
a[2]='b';
cout<
output boy
I hope you got the point!!