C# Program for Reverse a String using Recursion

This blog defines how to make reverse a string using recursion in C#.

using System;
using
System.Collections.Generic;
using
System.Text;
using
System.Linq;

namespace Armstrong
{
    class programme
    {
        static void Main(string[] args)
        {
           Char str[20];
           void rev(char *);
           console.writeline("enter string");
           str = console.readline();
           console.writeline("the reverse string is");
           rev(str);
        }
        void rev(char* p)
        {
            if (*p)
            {
                rev(++p);
                console.writeline("string is {0}", (-p));
            }
        }
    }
}

Ebook Download
View all
Learn
View all