$24
Objectives:
1. Implement a basic recursive function
Question 1:
Implement a recursive function that counts the number of occurrences of a character in a string.
The function declaration must be:
/*
Returns the number of occurrences of n in the string
str, starting a position idx of str.
*/
int freq(string str, int idx, char n)
Use the newly defined function in a new program that prompts the user for a string and a character to look for in that string. No looping structure is allowed inside freq function.
Example 1:
The output should match the example below.
Please input a string: ThisIsAString
Please input a character to count: i
i occurs 2 times in a string of characters