I am trying to sort char array like this:
#include<algorithm>
...
char x[] = "coast";
sort(x, x+5);
std::cout<<x;
But it displays garbage. Integer arrays are sorted properly however.
I am trying to sort char array like this:
#include<algorithm>
...
char x[] = "coast";
sort(x, x+5);
std::cout<<x;
But it displays garbage. Integer arrays are sorted properly however.
Works fine over here
[~]> clang++ test.cpp
[~]> ./a.out
acost
main() and all) you tried, and (if possible) the exact result. This should work.