Sha256: 56125ad41187a1a129d120f12714ca1d49a0ab744f7eb4fabda1cde291e779a7
Contents?: true
Size: 374 Bytes
Versions: 145
Compression:
Stored size: 374 Bytes
Contents
#include <stddef.h> #include <string.h> #include "hamming.h" int compute(const char *lhs, const char *rhs) { int count = -1; if (lhs && rhs && (strlen(lhs) == strlen(rhs))) { count = 0; int length = (int)strlen(lhs); for (int i = 0; i < length; ++i) { if (lhs[i] != rhs[i]) { ++count; } } } return count; }
Version data entries
145 entries across 145 versions & 1 rubygems