Pointer to the destination array where the transformed string is stored. If this is NULL, the function just returns the length of the transformed string.
2nd Parameter Type : const char *
Pointer to read-only string
2nd Parameter
Pointer to the null-terminated string to be transformed.
3rd Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
3rd Parameter
The maximum number of characters to be written to `dest`, including the null terminator.
Read more about parameters of strxfrm in parameters section
The strxfrmfunction in C language Transforms the string to another string such that the result of strcmp on these is the same as strcoll on the original strings.
The strxfrm function transforms the string src and places the resulting string into dest. The transformation is such that if strcmp is applied to two transformed strings, it returns the same result as strcoll applied to the original strings. This is useful for preparing strings for locale-specific sorting.
The strxfrmfunction takes 3
parameters:
•
char * `dest`: Pointer to the destination array where the transformed string is stored. If this is NULL, the function just returns the length of the transformed string.
•
const char * `src`: Pointer to the null-terminated string to be transformed.
•
size_t `n`: The maximum number of characters to be written to `dest`, including the null terminator.
Transforms the string pointed to by `src` into a locale-specific collated form and stores it in `dest`. The transformation is based on the current locale's collation rules. If `n` is 0, no characters are written, and the function returns the length of the transformed string. Returns the length of the transformed string, which may be larger than `n`.
The strxfrm function return value :
Returns the length of the transformed string (not including the terminating null byte)
If the return value is greater than or equal to n, the contents of dest are indeterminate
Output
This example demonstrates basic usage of strxfrm to transform a string according to the current locale.