char a[] = {'t' , 'e' , 's' , 't' , 'i' , 'n' , 'g'};
sort(a,a+7);
This works absolutely fine.
char*a = "testing";
sort(a, a+7);
This fails to run. why is it not being sorted?
string a = "testing";
sort(a.begin(),a.end());
This works fine..
string a ="testing";
sort(a , a+7);
But this fails. Here 'a' is a C++ string but why is it necessary to use iterators here ?
Aucun commentaire:
Enregistrer un commentaire