Just Do It...
C++ programming, Interview questions, Algorithms and Data Structures
reverse a C-Style String
void reverse(char *str)
{
char * end = str;
char tmp;
if (str)
{
while (*end) {
++end;
}
--end;
while (str < end) {
tmp = *str;
*str++ = *end;
*end-- = tmp;
}
}
}
Newer Post
Older Post
Home