Trying to a quick program that tells how many instances of a certain character there are in a word. It seems like I'm on the right track, but with some hitches.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
unsigned howMany(char c, const const * s);
int main(){
char *s = "Mississippi";
char c = 'o';
printf_s("There are %u '%c's", howMany(c, s), c);
unsigned howMany(char c, const const *s) {
if (*s == '\0') return 0;
else if (*s != c) { s++; howMany(c, s); }
else (*s == c); {
s++;
return 1 + howMany(c, s);
}
}