Yes, in your comparision, use strcmp for C, and std::string::compare for C++. Both functions will compare the strings, and return an integer with the following meanings...
< 0 — Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter.
= 0 — They compare equal
> 0 — Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.
This will also take into account "Hello" vs. "Hell" and will will subsequently sort "Hell" before "Hello".
Note: If you find that you are like me, and have a hard time remembering what the result means. Simply put the comparison operator (as in the example above) inbetween str1 and str2. So, for example, if you called strcmp(str1, str2) and the result was < 0, then look at it like str1 < str2.
"Hello"/"Hell"appropriately (usually that means that"Hell" < "Hello").<sign. ByHell < HelloI mean thatHellwould go beforeHello. I certainly hope you're not asking whetherHellshould be beforeHallalphabetically....std::sort()?