write a function that receives a pointer to a character string andreturns the nu
ID: 3611048 • Letter: W
Question
write a function that receives a pointer to a character string andreturns the number of repeated characters that occur in the string.For example, the string "Mississippi" has three repeatedcharacters. Do not count repeated blanks in the string. If acharacter occurs more than two times, it should still only count asone repeated character; thus"hisssss" would only have one repeatedcharacter. Assume that the function has the prototypestatement:int repeat(char *ptr);
All help is appreciated. Thank you!
Explanation / Answer
//Hope this will help you. //Don't forget to rate .it #include #include #include using namespace std; int repeat(char *ptr) { int i; char r_char[100]; char *data_ptr=ptr+1; int r_count=0,count=0; char prev=ptr[0]; for(int i = 1; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.