ProAnswers.org

How to reverse a string in C?

please provide me sample code for reversing the string.

2 Likes

Reversing a string using XOR

#include
#include

char* rev(char* str)
{
int end= strlen(str)-1;
int start = 0;

while( start

you can use this simple function

void string_reverse(char* str)
{
int i, j, len;
char temp;

len=strlen(str);
for (i=0, j=len-1; i<=j; i++, j--)
{
	tmp=str[i];
	str[i]=str[j];
	str[j]=tmp;
}

}