C and C++ programs and MySQL
Always thinking in engineering style...
Showing posts with label
Reverse a string
.
Show all posts
Showing posts with label
Reverse a string
.
Show all posts
Tuesday, March 8, 2011
Reverse a string
void ReverseString (char *String)
{
char *Begin = String;
char *End = String + strlen(String) - 1;
char TempChar = '\0';
while (Begin < End)
{
TempChar = *Begin;
*Begin = *End;
*End = TempChar;
Begin++;
End--;
}
}
Older Posts
Home
Subscribe to:
Posts (Atom)