The strxfrm function transforms the string pointed to by s2, and stores the resulting string in the array pointed to by s1. No more than maxchar bytes, including the null terminator, are placed into the array pointed to by s1. If the value of maxchar is less than the required size to store the transformed string (including the terminating null), the contents of the array pointed to by s1 is indeterminate. In such a case, the function returns the size of the transformed string. If maxchar is 0, then s1 is allowed to be a NULL pointer, and the function returns the required size of the s1 array before making the transformation. The string comparison functions, strcoll and strcmp, can produce different results given the same two strings to compare. The reason for this is that strcmp does a straightforward comparison of the code point values of the characters in the strings, whereas strcoll uses the locale information to do the comparison. Depending on the locale, the strcoll comparison can be a multipass operation, which is slower than strcmp. The purpose of the strxfrm function is to transform strings in such a way that if you pass two transformed strings to the strcmp function, the result is the same as passing the two original strings to the strcoll function. The strxfrm function is useful in applications that need to do a large number of comparisons on the same strings using strcoll. In this case, it might be more efficient (depending on the locale) to transform the strings once using strxfrm, and then do comparisons using strcmp.