Sha256: 62a0836d89681b977ef88f7edcf7524d9b1bb094692ec3bc228c31bd1eb51456

Contents?: true

Size: 347 Bytes

Versions: 251

Compression:

Stored size: 347 Bytes

Contents

#include <stddef.h>
#include <string.h>
#include "hamming.h"

size_t compute(const char *lhs, const char *rhs)
{
   size_t lhs_len = strlen(lhs);
   size_t rhs_len = strlen(rhs);
   size_t count = 0;
   size_t i = 0;
   for (i = 0; i < lhs_len && i < rhs_len; ++i) {
      if (lhs[i] != rhs[i]) {
         ++count;
      }
   }
   return count;
}

Version data entries

251 entries across 251 versions & 1 rubygems

Version Path
trackler-2.2.1.33 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.32 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.31 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.30 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.29 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.28 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.27 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.26 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.25 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.24 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.23 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.22 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.21 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.20 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.19 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.18 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.17 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.16 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.15 tracks/c/exercises/hamming/src/example.c
trackler-2.2.1.14 tracks/c/exercises/hamming/src/example.c