Skip to content

Instantly share code, notes, and snippets.

@ashleighbasil
Created February 23, 2021 02:32
Show Gist options
  • Save ashleighbasil/bce5be16c68b9e33cf50da331177688d to your computer and use it in GitHub Desktop.
Save ashleighbasil/bce5be16c68b9e33cf50da331177688d to your computer and use it in GitHub Desktop.
Cassidoo newsletter every other toy problem
int every_other(char *str) {
// Empty string edge case
if (!(*str)) return 0;
char current = *str;
int counter = 0;
str++;
while (*str) {
if (current == *str) {
counter++;
}
current = *str;
str++;
}
return counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment