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

Version Path
trackler-2.2.1.180 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.179 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.178 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.177 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.176 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.175 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.174 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.173 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.172 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.171 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.170 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.169 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.167 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.166 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.165 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.164 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.163 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.162 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.161 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.160 tracks/c/exercises/hamming/src/example.c