mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 20:13:04 +00:00
[UCRT] Import Microsoft.Windows.SDK.CRTSource version 10.0.22621.3
Imported from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource/10.0.22621.3 License: MIT
This commit is contained in:
parent
f1b60c66f0
commit
04e0dc4a7a
568 changed files with 115483 additions and 0 deletions
51
sdk/lib/ucrt/string/strrev.c
Normal file
51
sdk/lib/ucrt/string/strrev.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/***
|
||||
*strrev.c - reverse a string in place
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
*Purpose:
|
||||
* defines _strrev() - reverse a string in place (not including
|
||||
* '\0' character)
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/***
|
||||
*char *_strrev(string) - reverse a string in place
|
||||
*
|
||||
*Purpose:
|
||||
* Reverses the order of characters in the string. The terminating
|
||||
* null character remains in place.
|
||||
*
|
||||
*Entry:
|
||||
* char *string - string to reverse
|
||||
*
|
||||
*Exit:
|
||||
* returns string - now with reversed characters
|
||||
*
|
||||
*Exceptions:
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
char * __cdecl _strrev (
|
||||
char * string
|
||||
)
|
||||
{
|
||||
char *start = string;
|
||||
char *left = string;
|
||||
char ch;
|
||||
|
||||
while (*string++) /* find end of string */
|
||||
;
|
||||
string -= 2;
|
||||
|
||||
while (left < string)
|
||||
{
|
||||
ch = *left;
|
||||
*left++ = *string;
|
||||
*string-- = ch;
|
||||
}
|
||||
|
||||
return(start);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue