Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of strncasecmp function .
1st Parameter Type : const char *
Pointer to read-only string
1st Parameter
Pointer to the first null-terminated string to compare.
2nd Parameter Type : const char *
Pointer to read-only string
2nd Parameter
Pointer to the second null-terminated string to compare.
3rd Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
3rd Parameter
The maximum number of characters to compare from each string.
Read more about parameters of strncasecmp in parameters section
The strncasecmpfunction in C language Compares a specified number of characters from two strings, ignoring case.
The strncasecmp function compares up to n characters of two strings without sensitivity to case. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. This function is not part of the C standard library but is available in POSIX systems.
The strncasecmpfunction takes 3
parameters:
•
const char * `s1`: Pointer to the first null-terminated string to compare.
•
const char * `s2`: Pointer to the second null-terminated string to compare.
•
size_t `n`: The maximum number of characters to compare from each string.
Compares up to `n` characters of two null-terminated strings `s1` and `s2` in a case-insensitive manner. Returns a value less than, equal to, or greater than zero if `s1` is found to be less than, equal to, or greater than `s2`, respectively.
The strncasecmp function return value :
Returns an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2
Output
This example demonstrates basic usage of strncasecmp to compare the first 5 characters of two strings, ignoring case.