* Compare two strings. * * @param s1 The first string. * @param s2 The second string. * @return Returns a value less than zero, if s1 is shorter than s2. Returns * zero, if s1 equals s2. Returns a value greater than zero, if * s1 is longer than s2. */
| 88 | * s1 is longer than s2. |
| 89 | */ |
| 90 | int strcmp(const char *s1, const char *s2) |
| 91 | { |
| 92 | int res; |
| 93 | |
| 94 | for (size_t i = 0; 1; i++) { |
| 95 | res = s1[i] - s2[i]; |
| 96 | if (res || (s1[i] == '\0')) |
| 97 | break; |
| 98 | } |
| 99 | |
| 100 | return res; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Compare two strings with fixed length. |
no outgoing calls
no test coverage detected