I have a character array that I want to sort. The issue is if I pass the array as it is to the sort function than it actually converts the array characters which are actually numbers in their ASCII equivalents. For e.g. 4 become 52.
std::vector<int> classStudents;
....
char* cend = cAllowedStudents+maxAllowedStudents;
std::sort(cAllowedStudents, cend);
std::set_difference(classStudents.begin(), classStudents.end(),cAllowedStudents, cend,std::back_inserter(diff));
I also tried converting the whole array into separate int array through this, (however ideally I don’t want to use another array but only as a last choice):
iAllowedStudents[i]=(int)cAllowedStudents[i];
But it also does the same, so how can I convert this cAllowedStudents to be used with std::set_difference
classStudents?'a' < '4'or'a' > '4'?