memcmp method

int memcmp(
  1. CString str1,
  2. CString str2,
  3. int n
)

Compares the first n bytes of str1 and str2.

Implementation

int memcmp(CString str1, CString str2, int n) {
  for (int i = 0; i < n; i++) {
    if (str1[i] != str2[i]) return str1[i] - str2[i];
  }
  return 0;
}