strcmp
Syntax
- int strcmp(const char* s1, const char* s2)
Arguments
- s1
- Pointer to the string to compare.
- s2
- Pointer to the string to which the first string is compared to.
Return
- An integer value indicating the result of the comparison.
Description
- Compares two string.
- If a negative value is returned, string s1 is found to be less then s2. If zero is returned, both strings are identical. If a value positive and greater then zero is returned, string s1 is greater than s2.
- Characters are compared by their order in the ASCII character map, this means number will be considered less then alphabetical characters, likewise capitals are considered greater than non-capitals.
Also see
- strncmp