C Program to Print Reverse of String Using Recursion

In this program, the user is ask to enter the string, after that the reverse string is find using Recursion and displayed on console. Recursion is the process of defining a problem n terms of itself. A recursive function is a function that calls itself during its execution. The process may repeat several times, outputting the result and the end of each iteration. The function fact() in program uses recursion to find factorial of a number. If the string is "Cricket" then the reverse string is the sequence of characters in reverse order means the reverse is "tekcirC".

Source Code
int reverse(char*, int);
void main()
    char str[20];
    printf("Enter the string: \n");
    printf("Reverse string is: \n");
    reverse(str, 0);
int reverse(char *s, int p)
    if(s[p] != '\0')
        reverse(s, p+1);
    printf("%c", s[p]);
Enter the string: 
hello world
Reverse string is: 
dlrow olleh