// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <cstring>

using namespace std;

void revrec(char *s1,char *s2)
{
   char tmp;
   if(s2 > s1)
   {
      tmp = *s1;
      *s1 = *s2;
      *s2 = tmp;
      revrec(s1+1,s2-1);
   }
}

void rev(char *s)
{
   revrec(s, s + strlen(s) - 1);
}

int main()
{
   char s[] = "12345";
   rev(s);
   cout << s << endl;
   char s2[] = "abcd";
   rev(s2);
   cout << s2 << endl;
   return 0;
}
