In this recipe, you will learn how to create a program that displays the first character to be repeated in a string. For example, if you enter the string racecar, the program should give the output as The first repetitive character in the string racecar is c. The program should display No character is repeated in the string if a string with no repetitive characters is entered.
Finding the occurrence of the first repetitive character in a string
How to do it…
- Define two strings called str1 and str2. Your strings can be of any length, but the last position in the string is fixed for the null character \0:
char str1[80],str2[80];
- Enter characters to be assigned to str1. The characters...