093. Write a program to reverse the given string in C language

#include<stdio.h>
#include<conio.h>
main()
{
	int i,j,len=0;
	char *s1,*s2;
	clrscr();
	printf("Enter the string ....");
	scanf("%s",s1);
	for(i=0;s1[i]!='\0';i++)
		len++;
	j=0;
	for(i=len-1;i>=0;i--)
	{
		s2[j]=s1[i];
		j++;
	}
	s2[j]='\0';
	printf("\nReversed String : %s",s2);
	getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *