First Occurrence in String
Lesson 6 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.
Challenge
EasyWrite a function named findIndex that gets a string s and character c and returns the index of the first occurrence of c in s, if it does not exist, return -1.
Example:
test, s->2Because charactersappears first time at index2
Try it yourself
#include <stdio.h>
int findIndex(char* s, char c) {
// Write code here
return -1;
}
All lessons in Recursion Challenges - Master The Recursive Thinking
1Easy Challenges
Fibonacci SequenceIs PalindromeLongest Common PrefixMerge Two Sorted ListsFactorialFirst Occurrence in String