programming-examples/c/_Basic/Reverse a string using pointers.c

15 lines
315 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
#include <stdio.h>
#include <conio.h>
void main()
{
char *s;
int len,i;
clrscr();
printf("\nENTER A STRING: ");
gets(s);
len=strlen(s);
printf("\nTHE REVERSE OF THE STRING IS:");
for(i=len;i>=0;i--)
printf("%c",*(s+i));
getch();
}