| Description
Someone asked how to
reverse a string in C . Here is an
example using the strrev() function
Code
/**************************************
reverse a string example using strrev()
function
***************************************/
#include <stdio.h>
#include <string.h>
int main(void)
{
char msg[50] = "programmershelp
string reverse";
char *reversed;
printf("Here is the first string
: %s\n",msg);
reversed = strrev(msg);
printf("here is the reversed
string : %s\n",reversed);
return 0;
}
Information
tested using Visual
C++ 6
|