diff --git a/count_char.c b/count_char.c index 947c3c2..58e3664 100644 --- a/count_char.c +++ b/count_char.c @@ -28,7 +28,7 @@ int count_char_recursive(const char* str, char c) { } // skips the first character by moving the pointer to the next character - char* truncated = str + 1; + const char* truncated = str + 1; // true is 1, false is 0. no need to write a ternary operator return (str[0] == c) + count_char_recursive(truncated, c);