Question
Write the definition of a recursive function named find that is passed a c-string and a char and returns with the pos of the char
Write the definition of a recursive function named find that is passed a c-string and a char and returns with the pos of the char if it finds the char within the c-string or returns -1 if the char is not found. For example, if a c-string named str containing the value this is my string and a char named c containing the value i is passed in to find, the function should return the value 2. However, if c contained the value a, then find would return -1. This is what the function call for the example above would look like: int foundAt = find(str, c); NOTE: This function takes a c-string, NOT a string. NOTE: No points will be awarded if you include a loop construct within your solution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started