Search



Thursday, 5 March 2015

Reverse String without using strrev

#include<stdio.h>
#include<string.h>
#include<conio.h>
void main() {
char str[100], temp;
int i=0,j=0;
clrscr();
printf("\n\n program to reverse the string ");
printf("\n Enter the string :");
gets(str);
j = strlen(str) - 1;
while (i < j)
{ temp = str[i];
str[i] = str[j];
str[j] = temp;
i++;
j--;
}
   printf("\n\n Reversed string is : %s", str);
getch();
}

No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.