C Programming Code Examples C > Strings Code Examples Program to find the First Capital Letter in a String using Recursion Program to find the First Capital Letter in a String using Recursion The following C program, using recursion, finds the first capital letter that exists in a string. We have included ctype.h in order to make use of "int isupper(char);" function that's defined inside the ctype.h headerfile. The isupper finction returns 1 if the passed character is an uppercase and returns 0 is the passed character is a lowercase. #include <stdio.h> #include <string.h> #include <ctype.h> char caps_check(char *); int main() { char string[25], letter; printf("Enter a string to find it's first capital letter: "); scanf("%s", string); letter = caps_check(string); if (letter == 0) { printf("No capital letter is present in %s.\n", string); } else { printf("The first capital letter in %s is %c.\n", string, letter); } return 0; } char caps_check(char *string) { static int j = 0; if (j < strlen(string)) { if (isupper(string[j])) { return string[j]; } else { j = j + 1; return caps_check(string); } } else return 0; }