REVERSE A STRING WITHOUT USING INBUILT STRING FUNCTIONS

/*PROGRAM TO REVERSE A STRING WITHOUT USING INBUILT STRING FUNCTIONS*/
#include<stdio.h>
#include<conio.h>
void main()
{
char a[15];
int i,count=0,j;
clrscr();
printf(“Enter any string: “);
gets(a);
printf(“Entered string is: “);
puts(a);
i=0;
while(a[i]!=’\0′)
{
count++;
i++;
}
printf(“Entered string in reverse order is: “);
for(j=count-1;j>=0;j–)
printf(“%c”,a[j]);
getch();
}

Leave a Reply

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