Tuesday, August 8, 2023

C# Program to Reverse a String Using Recursion

 

C Program to Reverse a String Using 

Recursion


// C program to reverse a string
// using recursion
# include <stdio.h>
 
// Function to print reverse of
// the passed string
void reverse(char *str)
{
  if (*str)
  {
    reverse(str + 1);
    printf("%c", *str);
  }
}
 
// Driver code
int main()
{
  char a[] = "Geeks for Geeks";
  reverse(a);
  return 0;
}


No comments:

Post a Comment

NET Core Code Security, Authorization/Authentication, and code architecture

Complex NET Core interview questions (Code Security, Authorization/Authentication, and code architecture)  _________________________________...