MCPcopy Create free account
hub / github.com/IntegralPilot/wasm_os / strcmp

Function strcmp

stdlib/cpp/cstring.hpp:3–11  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1namespace std {
2
3int strcmp(const char* s1, const char* s2) {
4 while (*s1 && *s2 && *s1 == *s2) {
5 s1++;
6 s2++;
7 }
8 // Return the difference between the current characters pointed to by s1 and s2
9 // This correctly handles the case where one string might be shorter than the other
10 return (unsigned char)*s1 - (unsigned char)*s2;
11}
12
13int strlen(const char* str) {
14 int len = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected