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