void swap( char *l, char *r )
{
char t = *l; *l = *r; *r = t;
}
void reverse( char *inString, int inStringLen )
{
char *front, *end;
for( front = inString, end = inString+inStringLen-1; front < end; front++, end-- )
swap( front, end );
}
//call as reverse(sampleString, strlen(sampleString));
No comments:
Post a Comment
Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.