C Program To Reverse The String Using Pointer

How to write a C Program To Reverse The String Using Pointer in C Programming Language ?


Solution For C Program :

/*C Program To Reverse The String Using Pointer.*/


#include<stdio.h>
#include<conio.h>
void reverse(char *);
void main()
{
clrscr();
  char st[10];
  gets(st);
  printf("reverse=");
  reverse(st);
  printf("\noriginal data=%s",st);
  getch();
}
void reverse(char *s)
{
  char c;
  if (*s==NULL)
  {
     return;
  }
  c=*s;
  s++;
  reverse(s);
  printf("%c",c);
}


You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable




Learn More :