Skip to content

Instantly share code, notes, and snippets.

@dnbaker
Created April 23, 2016 03:19
Show Gist options
  • Save dnbaker/04ea2249bd16b734b2c7fbd904cff341 to your computer and use it in GitHub Desktop.
Save dnbaker/04ea2249bd16b734b2c7fbd904cff341 to your computer and use it in GitHub Desktop.
Hamming distance
/* Assumes that both strings are of equal length.
*
*/
int hd(char *a, char *b) {
int ret = 0;
while(*a) ret += (*a++ != *b++);
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment